Skip to content

Commit 4827455

Browse files
committed
return object from findHomography, fix test
1 parent cbf2565 commit 4827455

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

cc/modules/calib3d/calib3d.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,10 @@ NAN_METHOD(Calib3d::FindHomography) {
8585
FF_OBJ mask = FF_NEW_INSTANCE(Mat::constructor);
8686
FF_UNWRAP_MAT_AND_GET(jsMat) = cv::findHomography(srcPoints, dstPoints, method, ransacReprojThreshold, FF_UNWRAP_MAT_AND_GET(mask), maxIters, confidence);
8787

88-
FF_ARR output = FF_NEW_ARRAY(2);
89-
output->Set(0, jsMat);
90-
output->Set(1, mask);
91-
92-
FF_RETURN(output);
88+
v8::Local<v8::Object> output = Nan::New<v8::Object>();
89+
Nan::Set(output, Nan::New("homography").ToLocalChecked(), jsMat);
90+
Nan::Set(output, Nan::New("mask").ToLocalChecked(), mask);
91+
info.GetReturnValue().Set(output);
9392
}
9493

9594
struct Calib3d::ComposeRTWorker : public SimpleWorker {

test/tests/modules/calib3d.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ describe('calib3d', () => {
6565
});
6666

6767
it('should calculate a valid homography', () => {
68-
const homography = cv.findHomography(srcPoints, dstPoints);
69-
assertPropsWithValue(homography)({ type: cv.CV_64F, rows: 3, cols: 3 });
68+
const output = cv.findHomography(srcPoints, dstPoints);
69+
assertPropsWithValue(output.homography)({ type: cv.CV_64F, rows: 3, cols: 3 });
7070
});
7171
});
7272

0 commit comments

Comments
 (0)