hybridgroup.gobot/examples/opencv_window.go

30 lines
515 B
Go
Raw Normal View History

package main
import (
"github.com/hybridgroup/gobot"
2014-05-23 11:53:15 +08:00
"github.com/hybridgroup/gobot/platforms/opencv"
cv "github.com/lazywei/go-opencv/opencv"
)
func main() {
2014-05-23 11:53:15 +08:00
gbot := gobot.NewGobot()
window := opencv.NewWindowDriver()
camera := opencv.NewCameraDriver(0)
work := func() {
camera.On(camera.Event("frame"), func(data interface{}) {
window.ShowImage(data.(*cv.IplImage))
})
}
2014-07-09 09:36:14 +08:00
robot := gobot.NewRobot("cameraBot",
[]gobot.Device{window, camera},
work,
)
gbot.AddRobot(robot)
2014-06-07 04:18:07 +08:00
gbot.Start()
}