2014-10-20 11:23:33 -05:00
|
|
|
/*
|
2016-07-13 10:44:47 -06:00
|
|
|
Package opencv contains the Gobot drivers for opencv.
|
2014-10-20 11:23:33 -05:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
2023-05-20 14:25:21 +02:00
|
|
|
# This package requires `opencv` to be installed on your system
|
2014-10-20 11:23:33 -05:00
|
|
|
|
|
|
|
Then you can install the package with:
|
|
|
|
|
2023-06-04 18:36:55 +02:00
|
|
|
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
|
2014-10-20 11:23:33 -05:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2016-12-08 13:24:03 +01:00
|
|
|
cv "gobot.io/x/go-opencv/opencv"
|
2023-05-20 14:25:21 +02:00
|
|
|
"gobot.io/x/gobot/v2"
|
|
|
|
"gobot.io/x/gobot/v2/platforms/opencv"
|
2014-10-20 11:23:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-01 17:53:39 +02:00
|
|
|
window := opencv.NewWindowDriver()
|
|
|
|
camera := opencv.NewCameraDriver(0)
|
2014-10-20 11:23:33 -05:00
|
|
|
|
|
|
|
work := func() {
|
2016-10-01 17:53:39 +02:00
|
|
|
camera.On(camera.Event("frame"), func(data interface{}) {
|
2014-10-20 11:23:33 -05:00
|
|
|
window.ShowImage(data.(*cv.IplImage))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("cameraBot",
|
|
|
|
[]gobot.Device{window, camera},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-18 21:37:10 +02:00
|
|
|
robot.Start()
|
2014-10-20 11:23:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
For further information refer to opencv README:
|
2016-12-21 10:54:15 +01:00
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/opencv/README.md
|
2014-10-20 11:23:33 -05:00
|
|
|
*/
|
2023-05-20 14:25:21 +02:00
|
|
|
package opencv // import "gobot.io/x/gobot/v2/platforms/opencv"
|