Coder Social home page Coder Social logo

koolhazz / opencv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chai2010/opencv

0.0 1.0 0.0 6.73 MB

Go bindings for OpenCV1.1 (Dev/Zero Dependencies).

Home Page: http://godoc.org/github.com/chai2010/opencv

License: BSD 3-Clause "New" or "Revised" License

Go 0.95% C 5.68% CMake 0.08% Batchfile 0.03% C++ 93.27%

opencv's Introduction

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 [email protected].

Thanks!

opencv's People

Contributors

chai2010 avatar

Watchers

Austin Chen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.