Merge pull request #4053 from vpisarev:calib3d_fixes

This commit is contained in:
Vadim Pisarevsky
2015-05-26 11:23:50 +00:00
8 changed files with 338 additions and 34 deletions

View File

@@ -2047,7 +2047,7 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
CV_Assert( CV_MAT_DEPTH(ctype) >= CV_32F && CV_MAT_CN(ctype) <= 2 );
CV_Assert( coeffs0.rows == 1 || coeffs0.cols == 1 );
int n = coeffs0.cols + coeffs0.rows - 2;
int n0 = coeffs0.cols + coeffs0.rows - 2, n = n0;
_roots0.create(n, 1, CV_MAKETYPE(cdepth, 2), -1, true, _OutputArray::DEPTH_MASK_FLT);
Mat roots0 = _roots0.getMat();
@@ -2063,6 +2063,12 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
coeffs[i] = C(rcoeffs[i], 0);
}
for( ; n > 1; n-- )
{
if( std::abs(coeffs[n].re) + std::abs(coeffs[n].im) > DBL_EPSILON )
break;
}
C p(1, 0), r(1, 1);
for( i = 0; i < n; i++ )
@@ -2100,6 +2106,9 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
roots[i].im = 0;
}
for( ; n < n0; n++ )
roots[n+1] = roots[n];
Mat(roots0.size(), CV_64FC2, roots).convertTo(roots0, roots0.type());
return maxDiff;
}