Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it's very easy; just as you imagined to do it. Add a new function after the current one in the five-point.cpp file:

cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, InputArray _cameraMatrix1, InputArray _cameraMatrix2, int method, double prob, double threshold, OutputArray _mask)

then recopy everything by duplicating each line containing cameraMatrix. E.g.:

_cameraMatrix1.getMat().convertTo(cameraMatrix2, CV_64F);
_cameraMatrix2.getMat().convertTo(cameraMatrix2, CV_64F);

same with the CV_ASSERT line and create fx1,cx1,fx2,cx2 from cameramatrix1 and cameramatrix2. Finally:

points1.col(0) = (points1.col(0) - cx1) / fx1;
points2.col(0) = (points2.col(0) - cx2) / fx2;
points1.col(1) = (points1.col(1) - cy1) / fy1;
points2.col(1) = (points2.col(1) - cy2) / fy2;

Then add the function declaration to the calib3d.hpp file after the original function declaration (around line 1698). Normally this should be all.

Recompile OpenCV, reinstall and enjoy :)

Yes, it's very easy; just as you imagined to do it. Add a new function after the current one in the five-point.cpp file:

cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, InputArray _cameraMatrix1, InputArray _cameraMatrix2, int method, double prob, double threshold, OutputArray _mask)

then recopy everything by duplicating each line containing cameraMatrix. E.g.:

_cameraMatrix1.getMat().convertTo(cameraMatrix2, _cameraMatrix1.getMat().convertTo(cameraMatrix1, CV_64F);
_cameraMatrix2.getMat().convertTo(cameraMatrix2, CV_64F);

same with the CV_ASSERT line and create fx1,cx1,fx2,cx2 from cameramatrix1cameraMatrix1 and cameramatrix2cameraMatrix2. Finally:

points1.col(0) = (points1.col(0) - cx1) / fx1;
points2.col(0) = (points2.col(0) - cx2) / fx2;
points1.col(1) = (points1.col(1) - cy1) / fy1;
points2.col(1) = (points2.col(1) - cy2) / fy2;

Then add the function declaration to the calib3d.hpp file after the original function declaration (around line 1698). Normally this should be all.

Recompile OpenCV, reinstall and enjoy :)