2014-10-21 00:23:33 +08:00
|
|
|
/*
|
2016-07-14 00:44:47 +08:00
|
|
|
Package opencv contains the Gobot drivers for opencv.
|
2014-10-21 00:23:33 +08:00
|
|
|
|
|
|
|
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() {
|
2016-10-01 23:53:39 +08:00
|
|
|
window := opencv.NewWindowDriver()
|
|
|
|
camera := opencv.NewCameraDriver(0)
|
2014-10-21 00:23:33 +08:00
|
|
|
|
|
|
|
work := func() {
|
2016-10-01 23:53:39 +08:00
|
|
|
camera.On(camera.Event("frame"), func(data interface{}) {
|
2014-10-21 00:23:33 +08:00
|
|
|
window.ShowImage(data.(*cv.IplImage))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("cameraBot",
|
|
|
|
[]gobot.Device{window, camera},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:37:10 +08:00
|
|
|
robot.Start()
|
2014-10-21 00:23:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
For further information refer to opencv README:
|
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/opencv/README.md
|
|
|
|
*/
|
|
|
|
package opencv
|