Go bindings for OpenCV1.1 (Dev/Zero Dependencies).
C++ C Go
Switch branches/tags
Nothing to show
Latest commit b83c682 Jun 13, 2015 @chai2010 fix some build error on darwin
fixes issue #4
Permalink
Failed to load latest commit information.
examples fix build Sep 28, 2014
ffmpeg.dll ffmpeg.dll/fetch-ffmpeg-dll.go: fix err fotmat string Feb 6, 2015
opencv110 fix some build error on darwin Jun 13, 2015
testdata add windows screenshot and test video. Aug 28, 2014
.gitignore import old work Aug 26, 2014
LICENSE add missing LICENSE Sep 19, 2014
Makefile.darwin fix more examples. Aug 27, 2014
Makefile.linux fix examples on linux Aug 31, 2014
Makefile.windows export VideoInput api (windows only) Aug 28, 2014
README.md Update README.md Oct 16, 2014
capi.go fix examples on linux Aug 31, 2014
generate_generic.go fix more examples. Aug 27, 2014
generate_windows.go fix more examples. Aug 27, 2014
hello.go fix build Sep 28, 2014
opencv.c zz Aug 26, 2014
opencv.h zz Aug 26, 2014
opencv_cv.go fix more examples. Aug 27, 2014
opencv_cv_types_h.go fix more examples. Aug 27, 2014
opencv_cxcore.go change videoinput api Aug 29, 2014
opencv_cxcore_cvver_h.go import old work Aug 26, 2014
opencv_cxcore_cvver_h_test.go import old work Aug 26, 2014
opencv_cxcore_cxcore_h.go zz Aug 26, 2014
opencv_cxcore_cxtypes_h.go fix more examples. Aug 27, 2014
opencv_cxcore_cxtypes_h_test.go import old work Aug 26, 2014
opencv_cxcore_error_h.go import old work Aug 26, 2014
opencv_cxcore_error_h_test.go import old work Aug 26, 2014
opencv_cxcore_example_test.go fix some build error on darwin Jun 13, 2015
opencv_cxcore_test.go import old work Aug 26, 2014
opencv_doc.go fix build Sep 28, 2014
opencv_highgui.go examples/cam.go: add video record Aug 28, 2014
videoinput_windows.go change videoinput api Aug 29, 2014

README.md

Go bindings for OpenCV1.1

PkgDoc: http://godoc.org/github.com/chai2010/opencv

Install

Install GCC or MinGW (download here) at first, and then run these commands:

  1. go get -d github.com/chai2010/opencv
  2. go generate and go install
  3. go run hello.go

Notes

If use TDM-GCC, and build error like this:

c:\tdm-gcc-64\x86_64-w64-mingw32\include\aviriff.h:3:25: error: 'refer' does not
 name a type
 * No warranty is given; refer to the file DISCLAIMER within this package.
 ...

You need fix the C:\TDM-GCC-64\x86_64-w64-mingw32\include\aviriff.h header first:

** // fixit: ** -> /**
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/

Example

// Copyright 2014 <chaishushan{AT}gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/chai2010/opencv"
)

func main() {
	filename := "./testdata/lena.jpg"
	if len(os.Args) == 2 {
		filename = os.Args[1]
	}

	image := opencv.LoadImage(filename)
	if image == nil {
		log.Fatalf("LoadImage %s failed!", filename)
	}
	defer image.Release()

	win := opencv.NewWindow("Go-OpenCV")
	defer win.Destroy()

	win.SetMouseCallback(func(event, x, y, flags int) {
		fmt.Printf("event = %d, x = %d, y = %d, flags = %d\n",
			event, x, y, flags,
		)
	})
	win.CreateTrackbar("Thresh", 1, 100, func(pos int) {
		fmt.Printf("pos = %d\n", pos)
	})

	win.ShowImage(image)
	opencv.WaitKey(0)
}

Screenshots

Edge

Inpaint

Video Player

Cameras

BUGS

Report bugs to chaishushan@gmail.com.

Thanks!