Documentation ¶
Overview ¶
Package opencv contains the Gobot drivers for opencv.
Installing:
This package requires `opencv` to be installed on your system ¶
Then you can install the package with:
go get gobot.io/x/gobot && go install gobot.io/x/gobot/platforms/opencv
Example:
package main import ( cv "gobot.io/x/go-opencv/opencv" "gobot.io/x/gobot" "gobot.io/x/gobot/platforms/opencv" ) func main() { window := opencv.NewWindowDriver() camera := opencv.NewCameraDriver(0) work := func() { camera.On(camera.Event("frame"), func(data interface{}) { window.ShowImage(data.(*cv.IplImage)) }) } robot := gobot.NewRobot("cameraBot", []gobot.Device{window, camera}, work, ) robot.Start() }
For further information refer to opencv README: https://gobot.io/x/gobot/blob/master/platforms/opencv/README.md
Index ¶
Constants ¶
const (
// Frame event
Frame = "frame"
)
Variables ¶
This section is empty.
Functions ¶
func DetectFaces ¶
DetectFaces loads Haar cascade to detect face objects in image
Types ¶
type CameraDriver ¶
type CameraDriver struct { Source interface{} gobot.Eventer // contains filtered or unexported fields }
CameraDriver is the Gobot Driver for the OpenCV camera
func NewCameraDriver ¶
func NewCameraDriver(source interface{}, v ...time.Duration) *CameraDriver
NewCameraDriver creates a new driver with specified source. It also creates a start function to either set camera as a File or Camera capture.
func (*CameraDriver) Connection ¶
func (c *CameraDriver) Connection() gobot.Connection
Connection returns the Driver's connection
func (*CameraDriver) SetName ¶ added in v1.0.0
func (c *CameraDriver) SetName(n string)
SetName sets the Driver name
func (*CameraDriver) Start ¶
func (c *CameraDriver) Start() (err error)
Start initializes camera by grabbing a frame every `interval` and publishing an frame event
type WindowDriver ¶
type WindowDriver struct {
// contains filtered or unexported fields
}
WindowDriver is the Gobot Driver for the OpenCV window
func NewWindowDriver ¶
func NewWindowDriver() *WindowDriver
NewWindowDriver creates a new window driver. It adds an start function to initialize window
func (*WindowDriver) Connection ¶
func (w *WindowDriver) Connection() gobot.Connection
Connection returns the Driver's connection
func (*WindowDriver) Halt ¶
func (w *WindowDriver) Halt() (err error)
Halt returns true if camera is halted successfully
func (*WindowDriver) SetName ¶ added in v1.0.0
func (w *WindowDriver) SetName(n string)
SetName sets the Driver name
func (*WindowDriver) ShowImage ¶
func (w *WindowDriver) ShowImage(image *cv.IplImage)
ShowImage displays image in window
func (*WindowDriver) Start ¶
func (w *WindowDriver) Start() (err error)
Start starts window thread and driver