Giter VIP home page Giter VIP logo

go-opencv's Introduction

#Go OpenCV binding

Why fork?

Original project (https://code.google.com/p/go-opencv) looks abandoned. Therefore, I decide to fork it and host it on Github, so that others can help to maintain this package.

Install

Linux

  • install Go1 and OpenCV
  • go get github.com/lazywei/go-opencv
  • cd ${GoOpenCVRoot}/samples && go run hellocv.go

Windows

  • install Go1 and MinGW
  • install OpenCV-2.4.x to MinGW dir
    • libopencv*.dll --> ${MinGWRoot}\bin
    • libopencv*.lib --> ${MinGWRoot}\lib
    • include\opencv --> ${MinGWRoot}\include\opencv
    • include\opencv2 --> ${MinGWRoot}\include\opencv2
  • go get code.google.com/p/go-opencv/trunk/opencv
  • cd ${GoOpenCVRoot}/trunk/samples && go run hellocv.go

Example

Resizing

package main

import opencv "github.com/lazywei/go-opencv/opencv"

func main() {
	filename := "bert.jpg"
	srcImg := opencv.LoadImage(filename)
	if srcImg == nil {
		panic("Loading Image failed")
	}
	defer srcImg.Release()
	resized1 := opencv.Resize(srcImg, 400, 0, 0)
	resized2 := opencv.Resize(srcImg, 300, 500, 0)
	resized3 := opencv.Resize(srcImg, 300, 500, 2)
	opencv.SaveImage("resized1.jpg", resized1, 0)
	opencv.SaveImage("resized2.jpg", resized2, 0)
	opencv.SaveImage("resized3.jpg", resized3, 0)
}

Webcam

Yet another cool example is created by @saratovsource which demos how to use webcam:

cd samples
go run webcam.go

More

You can find more samples at: https://github.com/lazywei/go-opencv/tree/master/samples

Contribute

  • Fork this repo
  • Create new feature branch, git checkout -b your-feature-branch
  • Commit your change and push it to your repo git commit -m 'new feature'; git push origin your-feature-branch
  • Open pull request!

TODOs

  • More details doc
  • Implement more bindings

go-opencv's People

Contributors

lazywei avatar zankich avatar akirill0v avatar nfillot avatar chai2010 avatar

Watchers

James Cloos avatar lelequ 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.