Add support for native V4L implementation on Linux/RPi

This commit is contained in:
Milan Nikolic
2018-10-28 14:23:04 +01:00
parent 0503355005
commit ec60387edf
21 changed files with 348 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
// +build !cv3
// +build !cv3,!native
// Package camera.
package camera
@@ -15,6 +15,8 @@ import (
type Options struct {
Index int
Rotate int
Width float64
Height float64
}
// Camera represents camera.
@@ -34,6 +36,9 @@ func New(opts Options) (camera *Camera, err error) {
err = fmt.Errorf("camera: can not open camera %d", opts.Index)
}
camera.SetProperty(PropFrameWidth, opts.Width)
camera.SetProperty(PropFrameHeight, opts.Height)
return
}
@@ -43,7 +48,7 @@ func (c *Camera) Read() (img image.Image, err error) {
c.frame = c.camera.RetrieveFrame(1)
if c.frame == nil {
err = fmt.Errorf("camera: can not grab frame")
err = fmt.Errorf("camera: can not retrieve frame")
return
}