mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
More merging
This commit is contained in:
parent
930e11cd7f
commit
4e18f2a87e
@ -123,7 +123,7 @@ NAN_METHOD(Matrix::New) {
|
|||||||
Nan::ThrowTypeError("Cannot instantiate without new");
|
Nan::ThrowTypeError("Cannot instantiate without new");
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix *mat;
|
Matrix *mat=0;
|
||||||
|
|
||||||
if (info.Length() == 0) {
|
if (info.Length() == 0) {
|
||||||
mat = new Matrix;
|
mat = new Matrix;
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
#include "Stereo.h"
|
#include "Stereo.h"
|
||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
#if CV_MAJOR_VERSION < 3
|
|
||||||
#include <opencv2/legacy.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CV_MAJOR_VERSION >= 3
|
#if CV_MAJOR_VERSION >= 3
|
||||||
|
#include <opencv2/calib3d.hpp>
|
||||||
|
#include <opencv2/legacy.hpp>
|
||||||
#include <opencv2/ml.hpp>
|
#include <opencv2/ml.hpp>
|
||||||
#endif
|
#endif
|
||||||
// Block matching
|
// Block matching
|
||||||
@ -60,22 +59,27 @@ StereoBM::StereoBM(int preset, int ndisparities, int SADWindowSize) :
|
|||||||
Nan::ObjectWrap(),
|
Nan::ObjectWrap(),
|
||||||
stereo(preset, ndisparities, SADWindowSize) {
|
stereo(preset, ndisparities, SADWindowSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO make this async
|
||||||
|
NAN_METHOD(StereoBM::Compute) {
|
||||||
|
SETUP_FUNCTION(StereoBM)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get the arguments
|
// Get the arguments
|
||||||
|
|
||||||
// Arg 0, the 'left' image
|
// Arg 0, the 'left' image
|
||||||
Matrix* m0 = ObjectWrap::Unwrap<Matrix>(args[0]->ToObject());
|
Matrix* m0 = ObjectWrap::Unwrap<Matrix>(info[0]->ToObject());
|
||||||
cv::Mat left = m0->mat;
|
cv::Mat left = m0->mat;
|
||||||
|
|
||||||
// Arg 1, the 'right' image
|
// Arg 1, the 'right' image
|
||||||
Matrix* m1 = ObjectWrap::Unwrap<Matrix>(args[1]->ToObject());
|
Matrix* m1 = ObjectWrap::Unwrap<Matrix>(info[1]->ToObject());
|
||||||
cv::Mat right = m1->mat;
|
cv::Mat right = m1->mat;
|
||||||
|
|
||||||
// Optional 3rd arg, the disparty depth
|
// Optional 3rd arg, the disparty depth
|
||||||
int type = CV_16S;
|
int type = CV_16S;
|
||||||
if(args.Length() > 2)
|
if(info.Length() > 2)
|
||||||
{
|
{
|
||||||
type = args[2]->IntegerValue();
|
type = info[2]->IntegerValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute stereo using the block matching algorithm
|
// Compute stereo using the block matching algorithm
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
#define __NODE_STEREO_H
|
#define __NODE_STEREO_H
|
||||||
|
|
||||||
#include "OpenCV.h"
|
#include "OpenCV.h"
|
||||||
#include <opencv2/calib3d.hpp>
|
|
||||||
|
|
||||||
class StereoBM: public Nan::ObjectWrap {
|
class StereoBM: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::StereoBM> stereo;
|
cv::Ptr<cv::StereoBM> stereo;
|
||||||
|
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Local<Object> target);
|
static void Init(Local<Object> target);
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
@ -21,7 +22,7 @@ public:
|
|||||||
|
|
||||||
class StereoSGBM: public Nan::ObjectWrap {
|
class StereoSGBM: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
cv::Ptr<cv::StereoSGBM> stereo;
|
cv::Ptr<cv::StereoBM> stereo;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Local<Object> target);
|
static void Init(Local<Object> target);
|
||||||
@ -44,7 +45,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CV_VERSION_MAJOR < 3
|
#if CV_MAJOR_VERSION < 3
|
||||||
|
|
||||||
struct CvStereoGCState;
|
struct CvStereoGCState;
|
||||||
|
|
||||||
@ -61,4 +62,5 @@ public:
|
|||||||
JSFUNC(Compute);
|
JSFUNC(Compute);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user