mirror of
https://github.com/gen2brain/cam2ip.git
synced 2026-01-11 00:58:30 +00:00
Add support for native V4L implementation on Linux/RPi
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user