mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Added reprojectImageTo3D
This commit is contained in:
parent
17afbceabd
commit
92a9369d69
@ -132,6 +132,7 @@ void Calib3D::Init(Handle<Object> target)
|
||||
NODE_SET_METHOD(obj, "stereoCalibrate", StereoCalibrate);
|
||||
NODE_SET_METHOD(obj, "stereoRectify", StereoRectify);
|
||||
NODE_SET_METHOD(obj, "computeCorrespondEpilines", ComputeCorrespondEpilines);
|
||||
NODE_SET_METHOD(obj, "reprojectImageTo3D", ReprojectImageTo3D);
|
||||
|
||||
target->Set(NanNew("calib3d"), obj);
|
||||
}
|
||||
@ -551,3 +552,38 @@ NAN_METHOD(Calib3D::ComputeCorrespondEpilines)
|
||||
NanReturnUndefined();
|
||||
}
|
||||
}
|
||||
|
||||
// cv::reprojectImageTo3D
|
||||
NAN_METHOD(Calib3D::ReprojectImageTo3D)
|
||||
{
|
||||
NanEscapableScope();
|
||||
|
||||
try {
|
||||
// Get the arguments
|
||||
|
||||
// Arg0, the disparity image
|
||||
cv::Mat disparity = matFromMatrix(args[0]);
|
||||
|
||||
// Arg1, the depth-to-disparity transformation Q
|
||||
cv::Mat Q = matFromMatrix(args[1]);
|
||||
|
||||
// Arg 2, handle missing values, skipped for now
|
||||
|
||||
// Arg3, output bit depth, skipped for now
|
||||
|
||||
// Compute the depth image
|
||||
cv::Mat depthImage;
|
||||
cv::reprojectImageTo3D(disparity, depthImage, Q);
|
||||
|
||||
// Wrap the depth image
|
||||
Local<Object> depthImageMatrix = matrixFromMat(depthImage);
|
||||
|
||||
NanReturnValue(depthImageMatrix);
|
||||
|
||||
|
||||
} catch (cv::Exception &e) {
|
||||
const char *err_msg = e.what();
|
||||
NanThrowError(err_msg);
|
||||
NanReturnUndefined();
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,8 @@ public:
|
||||
static NAN_METHOD(StereoRectify);
|
||||
|
||||
static NAN_METHOD(ComputeCorrespondEpilines);
|
||||
|
||||
static NAN_METHOD(ReprojectImageTo3D);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user