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:
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
go get gobot.io/x/gobot && go install gobot.io/x/gobot/platforms/opencv
|
2014-10-21 00:23:33 +08:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2016-12-08 20:24:03 +08:00
|
|
|
cv "gobot.io/x/go-opencv/opencv"
|
|
|
|
"gobot.io/x/gobot"
|
|
|
|
"gobot.io/x/gobot/platforms/opencv"
|
2014-10-21 00:23:33 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
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:
|
2016-12-21 17:54:15 +08:00
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/opencv/README.md
|
2014-10-21 00:23:33 +08:00
|
|
|
*/
|
2016-12-08 20:24:03 +08:00
|
|
|
package opencv // import "gobot.io/x/gobot/platforms/opencv"
|