Documentation ¶
Overview ¶
Packge 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 github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/opencv
Example:
package main import ( cv "github.com/hybridgroup/go-opencv/opencv" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/opencv" ) func main() { gbot := gobot.NewGobot() window := opencv.NewWindowDriver("window") camera := opencv.NewCameraDriver("camera", 0) work := func() { gobot.On(camera.Event("frame"), func(data interface{}) { window.ShowImage(data.(*cv.IplImage)) }) } robot := gobot.NewRobot("cameraBot", []gobot.Device{window, camera}, work, ) gbot.AddRobot(robot) gbot.Start() }
For further information refer to opencv README: https://github.com/hybridgroup/gobot/blob/master/platforms/opencv/README.md
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectFaces ¶
DetectFaces loads Haar cascade to detect face objects in image
Types ¶
type CameraDriver ¶
type CameraDriver struct { gobot.Driver Source interface{} // contains filtered or unexported fields }
func NewCameraDriver ¶
func NewCameraDriver(name string, source interface{}) *CameraDriver
NewCameraDriver creates a new driver with specified name and source. It also creates a start function to either set camera as a File or Camera capture.
func (*CameraDriver) Start ¶
func (c *CameraDriver) Start() bool
Start initializes camera by grabbing a frame every `interval` and publishing an frame event
type WindowDriver ¶
func NewWindowDriver ¶
func NewWindowDriver(name string) *WindowDriver
NewWindowDriver creates a new window driver with specified name. It adds an start function to initialize window
func (*WindowDriver) Halt ¶
func (w *WindowDriver) Halt() bool
Halt returns true if camera is halted successfully
func (*WindowDriver) Init ¶
func (w *WindowDriver) Init() bool
Init returns true if driver is initialized correctly
func (*WindowDriver) ShowImage ¶
func (w *WindowDriver) ShowImage(image *cv.IplImage)
ShowImage displays image in window
func (*WindowDriver) Start ¶
func (w *WindowDriver) Start() bool
Start starts window thread and driver