-
Notifications
You must be signed in to change notification settings - Fork 858
OpenCV
The opencv module is the root of the node-opencv package.
var cv = require('opencv');
give an OpenCV object.
note: none of the below are actually asynchronous at the time of writing this wiki article
cv.readImage( imagefilename:String, function( err, img ){} )
Reads an image from disk using cv::imread(filename, CV_LOAD_IMAGE_UNCHANGED)
cv.readImage( imagedata:Buffer, function( err, img ){} )
Decodes an image from a Buffer using cv::imdecode(*mbuf, CV_LOAD_IMAGE_UNCHANGED)
cv.readImage( width:number, height:number, function( err, img ){} )
creates a Matrix of the specified size and of type CV_64FC1. currently not operational because arg 2 has to be a function!
cv.readImageMulti( imagefilename:String, function( err, arr ){} )
Reads a file containing multiple images and calls back with an array of Matrix objects using cv::imreadmulti(filename, mats);
Does nothing and returns false in openCV < 3.
Returns undefined (? - untested) in OpenCV3.
Modules in node-opencv are added to OpenCV according to their availability at compile time.
init.cc is responsible for calling the code to add modules; the basic list is:
Point::Init(target);
Matrix::Init(target);
#ifdef HAVE_OPENCV_OBJDETECT
CascadeClassifierWrap::Init(target);
#endif
#ifdef HAVE_OPENCV_VIDEOIO
VideoCaptureWrap::Init(target);
VideoWriterWrap::Init(target);
#endif
Contour::Init(target);
#ifdef HAVE_OPENCV_VIDEO
TrackedObject::Init(target);
#endif
#ifdef HAVE_OPENCV_HIGHGUI
NamedWindow::Init(target);
#endif
Constants::Init(target);
#ifdef HAVE_OPENCV_CALIB3D
Calib3D::Init(target);
#endif
#ifdef HAVE_OPENCV_IMGPROC
ImgProc::Init(target);
Histogram::Init(target);
#endif
#if CV_MAJOR_VERSION < 3
StereoBM::Init(target);
StereoSGBM::Init(target);
StereoGC::Init(target);
#if CV_MAJOR_VERSION == 2 && CV_MINOR_VERSION >=4
#ifdef HAVE_OPENCV_FEATURES2D
Features::Init(target);
#endif
LDAWrap::Init(target);
#endif
#endif
#ifdef HAVE_BACKGROUNDSUBTRACTOR
BackgroundSubtractorWrap::Init(target);
#endif
#ifdef HAVE_OPENCV_FACE
FaceRecognizerWrap::Init(target);
#endif
Each of these in general terms adds an object with methods to OpenCV;
For example, Matrix can be accessed like:
var mtx = new cv.Matrix();
Each module should have a separate page on the wiki (WIP).