Skip to content

Commit cbf2565

Browse files
committed
return mask from findHomography
1 parent 8782a6a commit cbf2565

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cc/modules/calib3d/calib3d.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,23 @@ NAN_METHOD(Calib3d::FindHomography) {
7373
FF_GET_UINT_IFDEF(optArgs, uint method, "method", 0);
7474
FF_GET_NUMBER_IFDEF(optArgs, double ransacReprojThreshold, "ransacReprojThreshold", 3);
7575
FF_GET_UINT_IFDEF(optArgs, uint maxIters, "maxIters", 2000);
76-
FF_GET_INSTANCE_IFDEF(optArgs, cv::Mat mask, "mask", Mat::constructor, FF_UNWRAP_MAT_AND_GET, Mat, cv::noArray().getMat())
7776
FF_GET_NUMBER_IFDEF(optArgs, double confidence, "confidence", 0.995);
7877
if (!hasOptArgsObj) {
7978
FF_ARG_UINT_IFDEF(2, method, method);
8079
FF_ARG_NUMBER_IFDEF(3, ransacReprojThreshold, ransacReprojThreshold);
8180
FF_ARG_UINT_IFDEF(4, maxIters, maxIters);
82-
FF_ARG_INSTANCE_IFDEF(5, mask, Mat::constructor, FF_UNWRAP_MAT_AND_GET, mask);
83-
FF_ARG_NUMBER_IFDEF(4, confidence, confidence);
81+
FF_ARG_NUMBER_IFDEF(5, confidence, confidence);
8482
}
8583

8684
FF_OBJ jsMat = FF_NEW_INSTANCE(Mat::constructor);
87-
FF_UNWRAP_MAT_AND_GET(jsMat) = cv::findHomography(srcPoints, dstPoints, method, ransacReprojThreshold, mask, maxIters, confidence);
88-
FF_RETURN(jsMat);
85+
FF_OBJ mask = FF_NEW_INSTANCE(Mat::constructor);
86+
FF_UNWRAP_MAT_AND_GET(jsMat) = cv::findHomography(srcPoints, dstPoints, method, ransacReprojThreshold, FF_UNWRAP_MAT_AND_GET(mask), maxIters, confidence);
87+
88+
FF_ARR output = FF_NEW_ARRAY(2);
89+
output->Set(0, jsMat);
90+
output->Set(1, mask);
91+
92+
FF_RETURN(output);
8993
}
9094

9195
struct Calib3d::ComposeRTWorker : public SimpleWorker {

0 commit comments

Comments
 (0)