2012-01-26 16:37:40 -08:00
2012-01-23 23:37:59 -08:00
2012-01-26 16:37:40 -08:00
2012-01-26 16:37:40 -08:00
2012-01-26 16:37:40 -08:00
2012-01-14 09:14:00 -08:00
2012-01-19 16:41:29 -08:00
2012-01-26 13:58:01 -08:00
wip
2012-01-25 09:20:04 -08:00
2012-01-26 16:37:40 -08:00
2012-01-24 17:38:19 -08:00
2012-01-26 13:24:48 -08:00
2012-01-24 12:23:08 -08:00

node-opencv

Build Status

OpenCV bindings for Node.js

Install

You'll need OpenCV installed. I'm using v2.2 because I couldn't get 2.3 to compile, but it should theoretically work with 2.3

Then:

    npm install opencv

Or to build the repo:

    node-waf configure && node-waf build

Examples

Face Detection

    var im = cv.readImage("./examples/test.jpg")

    im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, function(err, faces){  
      for (var i=0;i<faces.length; i++){
        var x = faces[i]
        im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
      }
      im.save('./out.jpg');   
             
    });

API Documentation

Matrix

The matrix is the most useful base datastructure in OpenCV. Things like images are just matrices of pixels.

Creation

    new Matrix(width, height)

Or you can use opencv to read in image files. Supported formats are in the OpenCV docs, but jpgs etc are supported.

    cv.readImage(filename, function(mat){
      ...
    })

    cv.readImage(buffer, function(mat){
      ...
    })

If you need to pipe data into an image, you can use an imagestream:

    var s = new cv.ImageStream()

    s.on('load', function(matrix){ 
      ...
    }) 

    fs.createReadStream('./examples/test.jpg').pipe(s);        

Accessors

Image Processing

WIP

This is a WIP. I've never written C++ before so the code may be interesting - if I'm doing stuff wrong please feel free to correct me.

Description
OpenCV Bindings for node.js
Readme 11 MiB
Languages
C++ 80.9%
JavaScript 17.7%
Python 1.2%
Makefile 0.1%