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 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 ¶
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 }
func NewCameraDriver ¶
func NewCameraDriver(name string, source interface{}, v ...time.Duration) *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) Connection ¶
func (c *CameraDriver) Connection() gobot.Connection
func (*CameraDriver) Name ¶
func (c *CameraDriver) Name() string
func (*CameraDriver) Start ¶
func (c *CameraDriver) Start() (errs []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
}
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) Connection ¶
func (w *WindowDriver) Connection() gobot.Connection
func (*WindowDriver) Halt ¶
func (w *WindowDriver) Halt() (errs []error)
Halt returns true if camera is halted successfully
func (*WindowDriver) Name ¶
func (w *WindowDriver) Name() string
func (*WindowDriver) ShowImage ¶
func (w *WindowDriver) ShowImage(image *cv.IplImage)
ShowImage displays image in window
func (*WindowDriver) Start ¶
func (w *WindowDriver) Start() (errs []error)
Start starts window thread and driver