hybridgroup.gobot/examples/opencv_window.go

26 lines
557 B
Go
Raw Normal View History

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