Adding feature 1544 and 1557
-cv::findHomography added a parameter for RANSAC iterations -cv::findHomography added a parameter for RANSAC confidence
This commit is contained in:
parent
dea40e5e99
commit
6ca893be23
@ -108,7 +108,8 @@ CV_EXPORTS_W void Rodrigues( InputArray src, OutputArray dst, OutputArray jacobi
|
||||
//! computes the best-fit perspective transformation mapping srcPoints to dstPoints.
|
||||
CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints,
|
||||
int method = 0, double ransacReprojThreshold = 3,
|
||||
OutputArray mask=noArray());
|
||||
OutputArray mask=noArray(), const int maxIters = 2000,
|
||||
const double confidence = 0.995);
|
||||
|
||||
//! variant of findHomography for backward compatibility
|
||||
CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints,
|
||||
|
@ -140,7 +140,9 @@ CVAPI(int) cvFindHomography( const CvMat* src_points,
|
||||
CvMat* homography,
|
||||
int method CV_DEFAULT(0),
|
||||
double ransacReprojThreshold CV_DEFAULT(3),
|
||||
CvMat* mask CV_DEFAULT(0));
|
||||
CvMat* mask CV_DEFAULT(0),
|
||||
int maxIters CV_DEFAULT(2000),
|
||||
double confidence CV_DEFAULT(0.995));
|
||||
|
||||
/* Computes RQ decomposition for 3x3 matrices */
|
||||
CVAPI(void) cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
|
||||
|
@ -299,7 +299,8 @@ CV_IMPL int cvRANSACUpdateNumIters( double p, double ep, int modelPoints, int ma
|
||||
|
||||
|
||||
CV_IMPL int cvFindHomography( const CvMat* _src, const CvMat* _dst, CvMat* __H, int method,
|
||||
double ransacReprojThreshold, CvMat* _mask )
|
||||
double ransacReprojThreshold, CvMat* _mask, int maxIters,
|
||||
double confidence)
|
||||
{
|
||||
cv::Mat src = cv::cvarrToMat(_src), dst = cv::cvarrToMat(_dst);
|
||||
|
||||
@ -308,9 +309,20 @@ CV_IMPL int cvFindHomography( const CvMat* _src, const CvMat* _dst, CvMat* __H,
|
||||
if( dst.channels() == 1 && (dst.rows == 2 || dst.rows == 3) && dst.cols > 3 )
|
||||
cv::transpose(dst, dst);
|
||||
|
||||
if ( maxIters < 0 )
|
||||
maxIters = 0;
|
||||
if ( maxIters > 2000 )
|
||||
maxIters = 2000;
|
||||
|
||||
if ( confidence < 0 )
|
||||
confidence = 0;
|
||||
if ( confidence > 1 )
|
||||
confidence = 1;
|
||||
|
||||
const cv::Mat H = cv::cvarrToMat(__H), mask = cv::cvarrToMat(_mask);
|
||||
cv::Mat H0 = cv::findHomography(src, dst, method, ransacReprojThreshold,
|
||||
_mask ? cv::_OutputArray(mask) : cv::_OutputArray());
|
||||
_mask ? cv::_OutputArray(mask) : cv::_OutputArray(), maxIters,
|
||||
confidence);
|
||||
|
||||
if( H0.empty() )
|
||||
{
|
||||
|
@ -274,10 +274,9 @@ public:
|
||||
|
||||
|
||||
cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
|
||||
int method, double ransacReprojThreshold, OutputArray _mask )
|
||||
int method, double ransacReprojThreshold, OutputArray _mask,
|
||||
const int maxIters, const double confidence)
|
||||
{
|
||||
const double confidence = 0.995;
|
||||
const int maxIters = 2000;
|
||||
const double defaultRANSACReprojThreshold = 3;
|
||||
bool result = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user