Exposed a bunch of OpenCV type constants.

This commit is contained in:
J David Smith 2014-09-18 13:33:47 -04:00
parent 21afdcd787
commit ede3feaf3d
4 changed files with 74 additions and 7 deletions

View File

@ -13,6 +13,7 @@
, "src/HighGUI.cc"
, "src/FaceRecognizer.cc"
, "src/BackgroundSubtractor.cc"
, "src/Constants.cc"
]
, 'libraries': [
'<!@(pkg-config --libs opencv)'
@ -47,4 +48,3 @@
]
}]
}

58
src/Constants.cc Normal file
View File

@ -0,0 +1,58 @@
#include "OpenCV.h"
#include "Constants.h"
#define CONST(C) inner->Set(String::NewSymbol(#C), Integer::New(C));
void
Constants::Init(Handle<Object> target) {
Persistent<Object> inner = Persistent<Object>::New(Object::New());
CONST(CV_8U);
CONST(CV_8S);
CONST(CV_16U);
CONST(CV_16S);
CONST(CV_32S);
CONST(CV_32F);
CONST(CV_64F);
CONST(CV_USRTYPE1);
CONST(CV_8UC1);
CONST(CV_8UC2);
CONST(CV_8UC3);
CONST(CV_8UC4);
CONST(CV_8SC1);
CONST(CV_8SC2);
CONST(CV_8SC3);
CONST(CV_8SC4);
CONST(CV_16UC1);
CONST(CV_16UC2);
CONST(CV_16UC3);
CONST(CV_16UC4);
CONST(CV_16SC1);
CONST(CV_16SC2);
CONST(CV_16SC3);
CONST(CV_16SC4);
CONST(CV_32SC1);
CONST(CV_32SC2);
CONST(CV_32SC3);
CONST(CV_32SC4);
CONST(CV_32FC1);
CONST(CV_32FC2);
CONST(CV_32FC3);
CONST(CV_32FC4);
CONST(CV_64FC1);
CONST(CV_64FC2);
CONST(CV_64FC3);
CONST(CV_64FC4);
target->Set(String::NewSymbol("Constants"), inner);
}
#undef CONST

6
src/Constants.h Normal file
View File

@ -0,0 +1,6 @@
#include "OpenCV.h"
class Constants: public node::ObjectWrap {
public:
static void Init(Handle<Object> target);
};

View File

@ -7,6 +7,7 @@
#include "CamShift.h"
#include "HighGUI.h"
#include "FaceRecognizer.h"
#include "Constants.h"
extern "C" void
@ -20,6 +21,8 @@ init(Handle<Object> target) {
Contour::Init(target);
TrackedObject::Init(target);
NamedWindow::Init(target);
Constants::Init(target);
#if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >=4
FaceRecognizerWrap::Init(target);