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.
@@ -37,6 +39,9 @@ func New(opts Options) (camera *Camera, err error) {
err = fmt.Errorf("camera: can not open camera %d: %s", opts.Index, err.Error())
}
camera.SetProperty(PropFrameWidth, opts.Width)
camera.SetProperty(PropFrameHeight, opts.Height)
return
}
@@ -55,7 +60,7 @@ func (c *Camera) Read() (img image.Image, err error) {
}
if c.frame == nil {
err = fmt.Errorf("camera: can not grab frame")
err = fmt.Errorf("camera: can not retrieve frame")
return
}