fixed 8-point case in findFundamentalMat (ticket #1262). findFundamentalMat needs to be rewritten actually (as well as findHomography)

pull/13383/head
Vadim Pisarevsky 13 years ago
parent 8b16dbe791
commit c57799a877
  1. 8
      modules/calib3d/src/fundam.cpp
  2. 21
      modules/core/src/lapack.cpp

@ -499,7 +499,7 @@ int CvFMEstimator::run8Point( const CvMat* _m1, const CvMat* _m2, CvMat* _fmatri
a[j*9+k] += r[j]*r[k];
}
cvSVD( &A, &W, 0, &V, CV_SVD_MODIFY_A + CV_SVD_V_T );
cvEigenVV(&A, &V, &W);
for( i = 0; i < 8; i++ )
{
@ -616,7 +616,7 @@ CV_IMPL int cvFindFundamentalMat( const CvMat* points1, const CvMat* points2,
(mask->rows == 1 || mask->cols == 1) &&
mask->rows*mask->cols == count );
}
if( mask || count > 8 )
if( mask || count >= 8 )
tempMask = cvCreateMat( 1, count, CV_8U );
if( !tempMask.empty() )
cvSet( tempMask, cvScalarAll(1.) );
@ -624,9 +624,9 @@ CV_IMPL int cvFindFundamentalMat( const CvMat* points1, const CvMat* points2,
CvFMEstimator estimator(7);
if( count == 7 )
result = estimator.run7Point(m1, m2, &_F9x3);
else if( count == 8 || method == CV_FM_8POINT )
else if( method == CV_FM_8POINT )
result = estimator.run8Point(m1, m2, &_F3x3);
else if( count >= 8 )
else
{
if( param1 <= 0 )
param1 = 3;

@ -1637,14 +1637,31 @@ CV_IMPL void
cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double,
int lowindex, int highindex)
{
cv::Mat src = cv::cvarrToMat(srcarr), evals = cv::cvarrToMat(evalsarr);
cv::Mat src = cv::cvarrToMat(srcarr), evals0 = cv::cvarrToMat(evalsarr), evals = evals0;
if( evectsarr )
{
cv::Mat evects = cv::cvarrToMat(evectsarr);
cv::Mat evects0 = cv::cvarrToMat(evectsarr), evects = evects0;
eigen(src, evals, evects, lowindex, highindex);
if( evects0.data != evects.data )
{
uchar* p = evects0.data;
evects.convertTo(evects0, evects0.type());
CV_Assert( p == evects0.data );
}
}
else
eigen(src, evals, lowindex, highindex);
if( evals0.data != evals.data )
{
uchar* p = evals0.data;
if( evals0.size() == evals.size() )
evals.convertTo(evals0, evals0.type());
else if( evals0.type() == evals.type() )
cv::transpose(evals, evals0);
else
cv::Mat(evals.t()).convertTo(evals0, evals0.type());
CV_Assert( p == evals0.data );
}
}

Loading…
Cancel
Save