hybridgroup.gobot/platforms/opencv
Adrian Zankich fd24e6a9fe Update docs 2014-10-28 14:52:59 -07:00
..
LICENSE WIP project restructure 2014-04-29 13:20:32 -07:00
README.md Update READMEs 2014-07-10 17:02:00 -07:00
camera_driver.go Adding godocs documentation to opencv package 2014-10-22 09:53:42 -05:00
camera_driver_test.go Add more opencv test coverage 2014-07-23 16:38:46 -07:00
doc.go Update docs 2014-10-28 14:52:59 -07:00
haarcascade_frontalface_alt.xml Add more opencv test coverage 2014-07-23 16:38:46 -07:00
lena-256x256.jpg Add more opencv test coverage 2014-07-23 16:38:46 -07:00
test_helper.go Mock out window creation in test 2014-07-23 16:54:39 -07:00
utils.go Adding godocs documentation to opencv package 2014-10-22 09:53:42 -05:00
utils_test.go Add more opencv test coverage 2014-07-23 16:38:46 -07:00
window_driver.go Adding godocs documentation to opencv package 2014-10-22 09:53:42 -05:00
window_driver_test.go Mock out window creation in test 2014-07-23 16:54:39 -07:00

README.md

OpenCV

This repository contains the Gobot drivers for opencv.

Getting Started

This package requires opencv to be installed on your system

OSX

To install opencv on OSX using Homebrew:

$ brew tap homebrew/science && brew install opencv

Ubuntu

Follow the official OpenCV installation guide

Windows

Follow the official OpenCV installation guide

Now you can install the package with

go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/opencv

Using

package main

import (
	cv "github.com/hybridgroup/go-opencv/opencv"
	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/opencv"
)

func main() {
	gbot := gobot.NewGobot()

	window := opencv.NewWindowDriver("window")
	camera := opencv.NewCameraDriver("camera", 0)

	work := func() {
		gobot.On(camera.Event("frame"), func(data interface{}) {
			window.ShowImage(data.(*cv.IplImage))
		})
	}

	robot := gobot.NewRobot("cameraBot",
		[]gobot.Device{window, camera},
		work,
	)

	gbot.AddRobot(robot)

	gbot.Start()
}