mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Swapped out all "handle" for "local"
Now building and passing tests locally in node v0.10.40 v0.12.7 and v4.1.1. Other modules would not build at node lower than v0.10, so I stopped there.
This commit is contained in:
parent
a0faef9e65
commit
ec09e0bdde
@ -32,7 +32,7 @@
|
|||||||
"main": "./lib/opencv",
|
"main": "./lib/opencv",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/keeganbrown/node-opencv.git"
|
"url": "https://github.com/peterbraden/node-opencv.git"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.12"
|
"node": ">=0.12"
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> BackgroundSubtractorWrap::constructor;
|
Nan::Persistent<FunctionTemplate> BackgroundSubtractorWrap::constructor;
|
||||||
|
|
||||||
void BackgroundSubtractorWrap::Init(Handle<Object> target) {
|
void BackgroundSubtractorWrap::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public:
|
|||||||
cv::Ptr<cv::BackgroundSubtractor> subtractor;
|
cv::Ptr<cv::BackgroundSubtractor> subtractor;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
BackgroundSubtractorWrap(cv::Ptr<cv::BackgroundSubtractor> bg);
|
BackgroundSubtractorWrap(cv::Ptr<cv::BackgroundSubtractor> bg);
|
||||||
|
|||||||
@ -10,12 +10,12 @@ inline Local<Object> matrixFromMat(cv::Mat &input) {
|
|||||||
return matrixWrap;
|
return matrixWrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline cv::Mat matFromMatrix(Handle<Value> matrix) {
|
inline cv::Mat matFromMatrix(Local<Value> matrix) {
|
||||||
Matrix* m = Nan::ObjectWrap::Unwrap<Matrix>(matrix->ToObject());
|
Matrix* m = Nan::ObjectWrap::Unwrap<Matrix>(matrix->ToObject());
|
||||||
return m->mat;
|
return m->mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline cv::Size sizeFromArray(Handle<Value> jsArray) {
|
inline cv::Size sizeFromArray(Local<Value> jsArray) {
|
||||||
cv::Size patternSize;
|
cv::Size patternSize;
|
||||||
|
|
||||||
if (jsArray->IsArray()) {
|
if (jsArray->IsArray()) {
|
||||||
@ -30,7 +30,7 @@ inline cv::Size sizeFromArray(Handle<Value> jsArray) {
|
|||||||
return patternSize;
|
return patternSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::vector<cv::Point2f> points2fFromArray(Handle<Value> array) {
|
inline std::vector<cv::Point2f> points2fFromArray(Local<Value> array) {
|
||||||
std::vector<cv::Point2f> points;
|
std::vector<cv::Point2f> points;
|
||||||
if (array->IsArray()) {
|
if (array->IsArray()) {
|
||||||
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
||||||
@ -48,7 +48,7 @@ inline std::vector<cv::Point2f> points2fFromArray(Handle<Value> array) {
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::vector<cv::Point3f> points3fFromArray(Handle<Value> array) {
|
inline std::vector<cv::Point3f> points3fFromArray(Local<Value> array) {
|
||||||
std::vector<cv::Point3f> points;
|
std::vector<cv::Point3f> points;
|
||||||
if (array->IsArray()) {
|
if (array->IsArray()) {
|
||||||
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
||||||
@ -68,7 +68,7 @@ inline std::vector<cv::Point3f> points3fFromArray(Handle<Value> array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline std::vector<std::vector<cv::Point2f> > points2fFromArrayOfArrays(
|
inline std::vector<std::vector<cv::Point2f> > points2fFromArrayOfArrays(
|
||||||
Handle<Value> array) {
|
Local<Value> array) {
|
||||||
std::vector<std::vector<cv::Point2f> > points;
|
std::vector<std::vector<cv::Point2f> > points;
|
||||||
if (array->IsArray()) {
|
if (array->IsArray()) {
|
||||||
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
||||||
@ -84,7 +84,7 @@ inline std::vector<std::vector<cv::Point2f> > points2fFromArrayOfArrays(
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline std::vector<std::vector<cv::Point3f> > points3fFromArrayOfArrays(
|
inline std::vector<std::vector<cv::Point3f> > points3fFromArrayOfArrays(
|
||||||
Handle<Value> array) {
|
Local<Value> array) {
|
||||||
std::vector<std::vector<cv::Point3f> > points;
|
std::vector<std::vector<cv::Point3f> > points;
|
||||||
if (array->IsArray()) {
|
if (array->IsArray()) {
|
||||||
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
Local<Array> pointsArray = Local<Array>::Cast(array->ToObject());
|
||||||
@ -99,7 +99,7 @@ inline std::vector<std::vector<cv::Point3f> > points3fFromArrayOfArrays(
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Calib3D::Init(Handle<Object> target) {
|
void Calib3D::Init(Local<Object> target) {
|
||||||
Nan::Persistent<Object> inner;
|
Nan::Persistent<Object> inner;
|
||||||
Local<Object> obj = Nan::New<Object>();
|
Local<Object> obj = Nan::New<Object>();
|
||||||
inner.Reset(obj);
|
inner.Reset(obj);
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
class Calib3D: public Nan::ObjectWrap {
|
class Calib3D: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(FindChessboardCorners);
|
static NAN_METHOD(FindChessboardCorners);
|
||||||
static NAN_METHOD(DrawChessboardCorners);
|
static NAN_METHOD(DrawChessboardCorners);
|
||||||
static NAN_METHOD(CalibrateCamera);
|
static NAN_METHOD(CalibrateCamera);
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> TrackedObject::constructor;
|
Nan::Persistent<FunctionTemplate> TrackedObject::constructor;
|
||||||
|
|
||||||
void TrackedObject::Init(Handle<Object> target) {
|
void TrackedObject::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public:
|
|||||||
cv::Rect prev_rect;
|
cv::Rect prev_rect;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
TrackedObject(cv::Mat image, cv::Rect rect, int channel);
|
TrackedObject(cv::Mat image, cv::Rect rect, int channel);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> CascadeClassifierWrap::constructor;
|
Nan::Persistent<FunctionTemplate> CascadeClassifierWrap::constructor;
|
||||||
|
|
||||||
void CascadeClassifierWrap::Init(Handle<Object> target) {
|
void CascadeClassifierWrap::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate> (CascadeClassifierWrap::New);
|
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate> (CascadeClassifierWrap::New);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ public:
|
|||||||
cv::CascadeClassifier cc;
|
cv::CascadeClassifier cc;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
CascadeClassifierWrap(v8::Value* fileName);
|
CascadeClassifierWrap(v8::Value* fileName);
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#define CONST_ENUM(C) \
|
#define CONST_ENUM(C) \
|
||||||
obj->Set(Nan::New<String>(#C).ToLocalChecked(), Nan::New<Integer>((int)(cv::C)));
|
obj->Set(Nan::New<String>(#C).ToLocalChecked(), Nan::New<Integer>((int)(cv::C)));
|
||||||
|
|
||||||
void Constants::Init(Handle<Object> target) {
|
void Constants::Init(Local<Object> target) {
|
||||||
Nan::Persistent<Object> inner;
|
Nan::Persistent<Object> inner;
|
||||||
Local<Object> obj = Nan::New<Object>();
|
Local<Object> obj = Nan::New<Object>();
|
||||||
inner.Reset(obj);
|
inner.Reset(obj);
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
class Constants: public Nan::ObjectWrap {
|
class Constants: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> Contour::constructor;
|
Nan::Persistent<FunctionTemplate> Contour::constructor;
|
||||||
|
|
||||||
void Contour::Init(Handle<Object> target) {
|
void Contour::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
// Class/contructor
|
// Class/contructor
|
||||||
@ -331,21 +331,21 @@ NAN_METHOD(Contour::Deserialize) {
|
|||||||
|
|
||||||
Contour *self = Nan::ObjectWrap::Unwrap<Contour>(info.This());
|
Contour *self = Nan::ObjectWrap::Unwrap<Contour>(info.This());
|
||||||
|
|
||||||
Handle<Object> data = Handle<Object>::Cast(info[0]);
|
Local<Object> data = Local<Object>::Cast(info[0]);
|
||||||
|
|
||||||
Handle<Array> contours_data = Handle<Array>::Cast(data->Get(Nan::New<String>("contours").ToLocalChecked()));
|
Local<Array> contours_data = Local<Array>::Cast(data->Get(Nan::New<String>("contours").ToLocalChecked()));
|
||||||
Handle<Array> hierarchy_data = Handle<Array>::Cast(data->Get(Nan::New<String>("hierarchy").ToLocalChecked()));
|
Local<Array> hierarchy_data = Local<Array>::Cast(data->Get(Nan::New<String>("hierarchy").ToLocalChecked()));
|
||||||
|
|
||||||
vector<vector<cv::Point> > contours_res;
|
vector<vector<cv::Point> > contours_res;
|
||||||
int contours_length = contours_data->Length();
|
int contours_length = contours_data->Length();
|
||||||
|
|
||||||
for (int i = 0; i < contours_length; i++) {
|
for (int i = 0; i < contours_length; i++) {
|
||||||
Handle<Array> contour_data = Handle<Array>::Cast(contours_data->Get(i));
|
Local<Array> contour_data = Local<Array>::Cast(contours_data->Get(i));
|
||||||
vector<cv::Point> points;
|
vector<cv::Point> points;
|
||||||
|
|
||||||
int contour_length = contour_data->Length();
|
int contour_length = contour_data->Length();
|
||||||
for (int j = 0; j < contour_length; j++) {
|
for (int j = 0; j < contour_length; j++) {
|
||||||
Handle<Array> point_data = Handle<Array>::Cast(contour_data->Get(j));
|
Local<Array> point_data = Local<Array>::Cast(contour_data->Get(j));
|
||||||
int x = point_data->Get(0)->IntegerValue();
|
int x = point_data->Get(0)->IntegerValue();
|
||||||
int y = point_data->Get(1)->IntegerValue();
|
int y = point_data->Get(1)->IntegerValue();
|
||||||
points.push_back(cv::Point(x, y));
|
points.push_back(cv::Point(x, y));
|
||||||
@ -358,7 +358,7 @@ NAN_METHOD(Contour::Deserialize) {
|
|||||||
int hierarchy_length = hierarchy_data->Length();
|
int hierarchy_length = hierarchy_data->Length();
|
||||||
|
|
||||||
for (int i = 0; i < hierarchy_length; i++) {
|
for (int i = 0; i < hierarchy_length; i++) {
|
||||||
Handle<Array> contour_data = Handle<Array>::Cast(hierarchy_data->Get(i));
|
Local<Array> contour_data = Local<Array>::Cast(hierarchy_data->Get(i));
|
||||||
int a = contour_data->Get(0)->IntegerValue();
|
int a = contour_data->Get(0)->IntegerValue();
|
||||||
int b = contour_data->Get(1)->IntegerValue();
|
int b = contour_data->Get(1)->IntegerValue();
|
||||||
int c = contour_data->Get(2)->IntegerValue();
|
int c = contour_data->Get(2)->IntegerValue();
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public:
|
|||||||
vector<cv::Vec4i> hierarchy;
|
vector<cv::Vec4i> hierarchy;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
Contour();
|
Contour();
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#if ((CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >=4))
|
#if ((CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >=4))
|
||||||
|
|
||||||
void Features::Init(Handle<Object> target) {
|
void Features::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
Nan::SetMethod(target, "ImageSimilarity", Similarity);
|
Nan::SetMethod(target, "ImageSimilarity", Similarity);
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
class Features: public Nan::ObjectWrap {
|
class Features: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
|
|
||||||
static NAN_METHOD(Similarity);
|
static NAN_METHOD(Similarity);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> NamedWindow::constructor;
|
Nan::Persistent<FunctionTemplate> NamedWindow::constructor;
|
||||||
|
|
||||||
void NamedWindow::Init(Handle<Object> target) {
|
void NamedWindow::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public:
|
|||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
NamedWindow(const std::string& winname, int flags);
|
NamedWindow(const std::string& winname, int flags);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "ImgProc.h"
|
#include "ImgProc.h"
|
||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
|
|
||||||
void ImgProc::Init(Handle<Object> target) {
|
void ImgProc::Init(Local<Object> target) {
|
||||||
Nan::Persistent<Object> inner;
|
Nan::Persistent<Object> inner;
|
||||||
Local<Object> obj = Nan::New<Object>();
|
Local<Object> obj = Nan::New<Object>();
|
||||||
inner.Reset(obj);
|
inner.Reset(obj);
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
class ImgProc: public Nan::ObjectWrap {
|
class ImgProc: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(Undistort);
|
static NAN_METHOD(Undistort);
|
||||||
static NAN_METHOD(InitUndistortRectifyMap);
|
static NAN_METHOD(InitUndistortRectifyMap);
|
||||||
static NAN_METHOD(Remap);
|
static NAN_METHOD(Remap);
|
||||||
|
|||||||
@ -9,7 +9,7 @@ cv::Scalar setColor(Local<Object> objColor);
|
|||||||
cv::Point setPoint(Local<Object> objPoint);
|
cv::Point setPoint(Local<Object> objPoint);
|
||||||
cv::Rect* setRect(Local<Object> objRect, cv::Rect &result);
|
cv::Rect* setRect(Local<Object> objRect, cv::Rect &result);
|
||||||
|
|
||||||
void Matrix::Init(Handle<Object> target) {
|
void Matrix::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
//Class
|
//Class
|
||||||
@ -312,7 +312,7 @@ NAN_METHOD(Matrix::GetData) {
|
|||||||
|
|
||||||
v8::Local<v8::Object> globalObj = Nan::GetCurrentContext()->Global();
|
v8::Local<v8::Object> globalObj = Nan::GetCurrentContext()->Global();
|
||||||
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(Nan::New<String>("Buffer").ToLocalChecked()));
|
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(Nan::New<String>("Buffer").ToLocalChecked()));
|
||||||
v8::Handle<v8::Value> constructorArgs[3] = {buf, Nan::New<v8::Integer>((unsigned) size), Nan::New<v8::Integer>(0)};
|
v8::Local<v8::Value> constructorArgs[3] = {buf, Nan::New<v8::Integer>((unsigned) size), Nan::New<v8::Integer>(0)};
|
||||||
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
|
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
|
||||||
|
|
||||||
info.GetReturnValue().Set(actualBuffer);
|
info.GetReturnValue().Set(actualBuffer);
|
||||||
@ -566,7 +566,7 @@ NAN_METHOD(Matrix::ToBuffer) {
|
|||||||
// See if the options argument is passed
|
// See if the options argument is passed
|
||||||
if ((info.Length() > 0) && (info[0]->IsObject())) {
|
if ((info.Length() > 0) && (info[0]->IsObject())) {
|
||||||
// Get this options argument
|
// Get this options argument
|
||||||
v8::Handle < v8::Object > options = v8::Handle<v8::Object>::Cast(info[0]);
|
v8::Handle < v8::Object > options = v8::Local<v8::Object>::Cast(info[0]);
|
||||||
// If the extension (image format) is provided
|
// If the extension (image format) is provided
|
||||||
if (options->Has(Nan::New<String>("ext").ToLocalChecked())) {
|
if (options->Has(Nan::New<String>("ext").ToLocalChecked())) {
|
||||||
v8::String::Utf8Value str(
|
v8::String::Utf8Value str(
|
||||||
@ -600,7 +600,7 @@ NAN_METHOD(Matrix::ToBuffer) {
|
|||||||
v8::Local < v8::Object > globalObj = Nan::GetCurrentContext()->Global();
|
v8::Local < v8::Object > globalObj = Nan::GetCurrentContext()->Global();
|
||||||
v8::Local < v8::Function > bufferConstructor = v8::Local < v8::Function
|
v8::Local < v8::Function > bufferConstructor = v8::Local < v8::Function
|
||||||
> ::Cast(globalObj->Get(Nan::New<String>("Buffer").ToLocalChecked()));
|
> ::Cast(globalObj->Get(Nan::New<String>("Buffer").ToLocalChecked()));
|
||||||
v8::Handle<v8::Value> constructorArgs[3] =
|
v8::Local<v8::Value> constructorArgs[3] =
|
||||||
{buf, Nan::New<v8::Integer>((unsigned)vec.size()), Nan::New<v8::Integer>(0)};
|
{buf, Nan::New<v8::Integer>((unsigned)vec.size()), Nan::New<v8::Integer>(0)};
|
||||||
v8::Local < v8::Object > actualBuffer = bufferConstructor->NewInstance(3,
|
v8::Local < v8::Object > actualBuffer = bufferConstructor->NewInstance(3,
|
||||||
constructorArgs);
|
constructorArgs);
|
||||||
@ -637,7 +637,7 @@ public:
|
|||||||
|
|
||||||
v8::Local<v8::Object> globalObj = Nan::GetCurrentContext()->Global();
|
v8::Local<v8::Object> globalObj = Nan::GetCurrentContext()->Global();
|
||||||
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(Nan::New<String>("Buffer").ToLocalChecked()));
|
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(Nan::New<String>("Buffer").ToLocalChecked()));
|
||||||
v8::Handle<v8::Value> constructorArgs[3] = {buf, Nan::New<v8::Integer>((unsigned)res.size()), Nan::New<v8::Integer>(0)};
|
v8::Local<v8::Value> constructorArgs[3] = {buf, Nan::New<v8::Integer>((unsigned)res.size()), Nan::New<v8::Integer>(0)};
|
||||||
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
|
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
|
||||||
|
|
||||||
Local<Value> argv[] = {
|
Local<Value> argv[] = {
|
||||||
@ -671,7 +671,7 @@ NAN_METHOD(Matrix::ToBufferAsync) {
|
|||||||
// See if the options argument is passed
|
// See if the options argument is passed
|
||||||
if ((info.Length() > 1) && (info[1]->IsObject())) {
|
if ((info.Length() > 1) && (info[1]->IsObject())) {
|
||||||
// Get this options argument
|
// Get this options argument
|
||||||
v8::Handle < v8::Object > options = v8::Handle<v8::Object>::Cast(info[1]);
|
v8::Handle < v8::Object > options = v8::Local<v8::Object>::Cast(info[1]);
|
||||||
// If the extension (image format) is provided
|
// If the extension (image format) is provided
|
||||||
if (options->Has(Nan::New<String>("ext").ToLocalChecked())) {
|
if (options->Has(Nan::New<String>("ext").ToLocalChecked())) {
|
||||||
v8::String::Utf8Value str(
|
v8::String::Utf8Value str(
|
||||||
@ -715,7 +715,7 @@ NAN_METHOD(Matrix::Ellipse) {
|
|||||||
int shift = 0;
|
int shift = 0;
|
||||||
|
|
||||||
if (info[0]->IsObject()) {
|
if (info[0]->IsObject()) {
|
||||||
v8::Handle < v8::Object > options = v8::Handle<v8::Object>::Cast(info[0]);
|
v8::Handle < v8::Object > options = v8::Local<v8::Object>::Cast(info[0]);
|
||||||
if (options->Has(Nan::New<String>("center").ToLocalChecked())) {
|
if (options->Has(Nan::New<String>("center").ToLocalChecked())) {
|
||||||
Local < Object > center =
|
Local < Object > center =
|
||||||
options->Get(Nan::New<String>("center").ToLocalChecked())->ToObject();
|
options->Get(Nan::New<String>("center").ToLocalChecked())->ToObject();
|
||||||
@ -1818,7 +1818,7 @@ NAN_METHOD(Matrix::Merge) {
|
|||||||
if (!info[0]->IsArray()) {
|
if (!info[0]->IsArray()) {
|
||||||
Nan::ThrowTypeError("The argument must be an array");
|
Nan::ThrowTypeError("The argument must be an array");
|
||||||
}
|
}
|
||||||
v8::Handle<v8::Array> jsChannels = v8::Handle<v8::Array>::Cast(info[0]);
|
v8::Local<v8::Array> jsChannels = v8::Local<v8::Array>::Cast(info[0]);
|
||||||
|
|
||||||
unsigned int L = jsChannels->Length();
|
unsigned int L = jsChannels->Length();
|
||||||
vector<cv::Mat> vChannels(L);
|
vector<cv::Mat> vChannels(L);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ public:
|
|||||||
|
|
||||||
cv::Mat mat;
|
cv::Mat mat;
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
Matrix();
|
Matrix();
|
||||||
Matrix(cv::Mat other, cv::Rect roi);
|
Matrix(cv::Mat other, cv::Rect roi);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
#include <nan.h>
|
#include <nan.h>
|
||||||
|
|
||||||
void OpenCV::Init(Handle<Object> target) {
|
void OpenCV::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
// Version string.
|
// Version string.
|
||||||
|
|||||||
@ -44,7 +44,7 @@ using namespace node;
|
|||||||
|
|
||||||
class OpenCV: public Nan::ObjectWrap {
|
class OpenCV: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
|
|
||||||
static NAN_METHOD(ReadImage);
|
static NAN_METHOD(ReadImage);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> Point::constructor;
|
Nan::Persistent<FunctionTemplate> Point::constructor;
|
||||||
|
|
||||||
void Point::Init(Handle<Object> target) {
|
void Point::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class Point: public Nan::ObjectWrap {
|
|||||||
public:
|
public:
|
||||||
CvPoint2D32f point;
|
CvPoint2D32f point;
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
Point(double x, double y);
|
Point(double x, double y);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> StereoBM::constructor;
|
Nan::Persistent<FunctionTemplate> StereoBM::constructor;
|
||||||
|
|
||||||
void StereoBM::Init(Handle<Object> target) {
|
void StereoBM::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(StereoBM::New);
|
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(StereoBM::New);
|
||||||
@ -98,7 +98,7 @@ NAN_METHOD(StereoBM::Compute) {
|
|||||||
// Semi-Global Block matching
|
// Semi-Global Block matching
|
||||||
Nan::Persistent<FunctionTemplate> StereoSGBM::constructor;
|
Nan::Persistent<FunctionTemplate> StereoSGBM::constructor;
|
||||||
|
|
||||||
void StereoSGBM::Init(Handle<Object> target) {
|
void StereoSGBM::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(StereoSGBM::New);
|
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(StereoSGBM::New);
|
||||||
@ -233,7 +233,7 @@ NAN_METHOD(StereoSGBM::Compute) {
|
|||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> StereoGC::constructor;
|
Nan::Persistent<FunctionTemplate> StereoGC::constructor;
|
||||||
|
|
||||||
void StereoGC::Init(Handle<Object> target) {
|
void StereoGC::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(StereoGC::New);
|
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(StereoGC::New);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public:
|
|||||||
cv::StereoBM stereo;
|
cv::StereoBM stereo;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
StereoBM(int preset = cv::StereoBM::BASIC_PRESET, int ndisparities = 0,
|
StereoBM(int preset = cv::StereoBM::BASIC_PRESET, int ndisparities = 0,
|
||||||
@ -23,7 +23,7 @@ public:
|
|||||||
cv::StereoSGBM stereo;
|
cv::StereoSGBM stereo;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
StereoSGBM();
|
StereoSGBM();
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
CvStereoGCState *stereo;
|
CvStereoGCState *stereo;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
StereoGC(int numberOfDisparities = 16, int maxIterations = 2);
|
StereoGC(int numberOfDisparities = 16, int maxIterations = 2);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ struct videocapture_baton {
|
|||||||
uv_work_t request;
|
uv_work_t request;
|
||||||
};
|
};
|
||||||
|
|
||||||
void VideoCaptureWrap::Init(Handle<Object> target) {
|
void VideoCaptureWrap::Init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
//Class
|
//Class
|
||||||
|
|||||||
@ -5,7 +5,7 @@ public:
|
|||||||
cv::VideoCapture cap;
|
cv::VideoCapture cap;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
|
|
||||||
VideoCaptureWrap(const std::string& filename);
|
VideoCaptureWrap(const std::string& filename);
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
#include "Stereo.h"
|
#include "Stereo.h"
|
||||||
#include "BackgroundSubtractor.h"
|
#include "BackgroundSubtractor.h"
|
||||||
|
|
||||||
extern "C" void init(Handle<Object> target) {
|
extern "C" void init(Local<Object> target) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
OpenCV::Init(target);
|
OpenCV::Init(target);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user