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");
|
||||
}
|
||||
|
||||
Matrix *mat;
|
||||
Matrix *mat=0;
|
||||
|
||||
if (info.Length() == 0) {
|
||||
mat = new Matrix;
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "Stereo.h"
|
||||
#include "Matrix.h"
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
#include <opencv2/legacy.hpp>
|
||||
#endif
|
||||
|
||||
#if CV_MAJOR_VERSION >= 3
|
||||
#include <opencv2/calib3d.hpp>
|
||||
#include <opencv2/legacy.hpp>
|
||||
#include <opencv2/ml.hpp>
|
||||
#endif
|
||||
// Block matching
|
||||
@ -60,22 +59,27 @@ StereoBM::StereoBM(int preset, int ndisparities, int SADWindowSize) :
|
||||
Nan::ObjectWrap(),
|
||||
stereo(preset, ndisparities, SADWindowSize) {
|
||||
}
|
||||
|
||||
// TODO make this async
|
||||
NAN_METHOD(StereoBM::Compute) {
|
||||
SETUP_FUNCTION(StereoBM)
|
||||
|
||||
try {
|
||||
// Get the arguments
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// Optional 3rd arg, the disparty depth
|
||||
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
|
||||
|
||||
@ -2,12 +2,13 @@
|
||||
#define __NODE_STEREO_H
|
||||
|
||||
#include "OpenCV.h"
|
||||
#include <opencv2/calib3d.hpp>
|
||||
|
||||
class StereoBM: public Nan::ObjectWrap {
|
||||
public:
|
||||
|
||||
cv::Ptr<cv::StereoBM> stereo;
|
||||
|
||||
|
||||
static Nan::Persistent<FunctionTemplate> constructor;
|
||||
static void Init(Local<Object> target);
|
||||
static NAN_METHOD(New);
|
||||
@ -21,7 +22,7 @@ public:
|
||||
|
||||
class StereoSGBM: public Nan::ObjectWrap {
|
||||
public:
|
||||
cv::Ptr<cv::StereoSGBM> stereo;
|
||||
cv::Ptr<cv::StereoBM> stereo;
|
||||
|
||||
static Nan::Persistent<FunctionTemplate> constructor;
|
||||
static void Init(Local<Object> target);
|
||||
@ -44,7 +45,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#if CV_VERSION_MAJOR < 3
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
|
||||
struct CvStereoGCState;
|
||||
|
||||
@ -61,4 +62,5 @@ public:
|
||||
JSFUNC(Compute);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user