Updated by Andrey Kamaev almost 13 years ago

Hi, I've noticed that the C++ version of the method @FindFundamentalMatrix()@, FindFundamentalMatrix(), in the file source:tags/2.4.0/opencv/modules/calib3d/src/fundam.cpp#L588, "OpenCV-2.4.0/./modules/calib3d/src/fundam.cpp", the mode @CV_FM_7POINT@ CV_FM_7POINT doesn't work as it is supposed to do. The C version allocates a 9x3 matrix in the mode @CV_FM_7POINT@, CV_FM_7POINT, in case 3 solutions are found. But the C++ version only allocates a 3x3 matrix, and then it calls to the C version. So, regardless the solution/s given by the C version, only one matrix will be filled.

The C++ call is:

<pre><code class="cpp">
cv::Mat cv::findFundamentalMat( InputArray _points1, InputArray _points2, int method, double param1, double aram2, OutputArray _mask )

{
Mat points1 = _points1.getMat(), points2 = _points2.getMat();
int npoints = points1.checkVector(2);
CV_Assert( npoints >= 0 && points2.checkVector(2) == npoints &&
points1.type() == points2.type());
Mat F(3, 3, CV_64F);
CvMat _pt1 = points1, _pt2 = points2;
CvMat matF = F, c_mask, *p_mask = 0;
if( _mask.needed() )
{
_mask.create(npoints, 1, CV_8U, -1, true);
p_mask = &(c_mask = _mask.getMat());
}
int n = cvFindFundamentalMat( &_pt1, &_pt2, &matF, method, param1, param2, p_mask );
if( n <= 0 )
F = Scalar(0);
return F;
}
</code></pre>



I'd say that it should take into account that a matrix 9x3 is needed in mode @CV_FM_7POINT@. CV_FM_7POINT.

Cheers,

Pedro

Back