Skip to content

Commit

Permalink
rm newCameraMatrix optionnal arg
Browse files Browse the repository at this point in the history
  • Loading branch information
piercus committed May 15, 2019
1 parent 3cea752 commit f62baf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
23 changes: 2 additions & 21 deletions cc/core/MatImgprocBindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2147,18 +2147,15 @@ namespace MatImgprocBindings {
struct UndistortWorker: public CatchCvExceptionWorker {
public:
cv::Mat mat;
cv::Size size;

UndistortWorker(cv::Mat mat) {
this->mat = mat;
this->size = cv::Size2d(mat.cols, mat.rows);
}

cv::Mat cameraMatrix;
cv::Mat distCoeffs;
cv::Mat newCameraMatrix;
cv::Mat undistortedMat;

FF_VAL getReturnValue() {
return Mat::Converter::wrap(undistortedMat);
}
Expand All @@ -2170,24 +2167,8 @@ namespace MatImgprocBindings {
);
}

bool unwrapOptionalArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
return (
Mat::Converter::arg(2, &newCameraMatrix, info)
);
}

bool hasOptArgsObject(Nan::NAN_METHOD_ARGS_TYPE info) {
return FF_ARG_IS_OBJECT(2);
}

bool unwrapOptionalArgsFromOpts(Nan::NAN_METHOD_ARGS_TYPE info) {
FF_OBJ opts = info[2]->ToObject(Nan::GetCurrentContext()).ToLocalChecked();
return (
Mat::Converter::optProp(&newCameraMatrix, "newCameraMatrix", opts)
);
}
std::string executeCatchCvExceptionWorker() {
cv::undistort(mat, undistortedMat, cameraMatrix, distCoeffs, newCameraMatrix);
cv::undistort(mat, undistortedMat, cameraMatrix, distCoeffs);
return "";
}

Expand Down
7 changes: 3 additions & 4 deletions test/tests/core/Mat/Mat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,16 +1056,15 @@ describe('Mat', () => {
});
describe('undistort', () => {
const cameraMatrix = new cv.Mat([[1, 0, 10],[0, 1, 10],[0, 0, 1]], cv.CV_32F);
const newCameraMatrix = new cv.Mat([[0.5, 0, 10],[0, 0.5, 10],[0, 0, 1]], cv.CV_32F);
const distCoeffs = new cv.Mat([[0.1, 0.1, 1, 1]], cv.CV_32F);
generateAPITests({
getDut: () => new cv.Mat(20, 20, cv.CV_8U, 0.5),
methodName: 'undistort',
methodNameSpace: 'Mat',
getRequiredArgs: () => ([cameraMatrix, distCoeffs]),
getOptionalArgs: () => ([
newCameraMatrix
])
expectOutput: (res, _, args) => {
expect(res).to.be.instanceOf(cv.Mat);
}
});
});
});

0 comments on commit f62baf6

Please sign in to comment.