mirror of
https://github.com/gen2brain/cam2ip.git
synced 2025-12-16 04:18:39 +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.
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user