added tests for http://code.opencv.org/issues/4011 and http://code.opencv.org/issues/3057; fixed random subset generation in both methods to increase chance for a good subset

This commit is contained in:
Vadim Pisarevsky
2015-05-25 21:46:05 +03:00
parent 2466ca02bf
commit 3bc5958c58
3 changed files with 124 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ public:
int _modelPoints=0, double _threshold=0, double _confidence=0.99, int _maxIters=1000)
: cb(_cb), modelPoints(_modelPoints), threshold(_threshold), confidence(_confidence), maxIters(_maxIters)
{
checkPartialSubsets = true;
checkPartialSubsets = false;
}
int findInliers( const Mat& m1, const Mat& m2, const Mat& model, Mat& err, Mat& mask, double thresh ) const
@@ -145,6 +145,9 @@ public:
ms2ptr[i*esz2 + k] = m2ptr[idx_i*esz2 + k];
if( checkPartialSubsets && !cb->checkSubset( ms1, ms2, i+1 ))
{
// we may have selected some bad points;
// so, let's remove some of them randomly
i = rng.uniform(0, i+1);
iters++;
continue;
}
@@ -206,7 +209,7 @@ public:
int i, goodCount, nmodels;
if( count > modelPoints )
{
bool found = getSubset( m1, m2, ms1, ms2, rng );
bool found = getSubset( m1, m2, ms1, ms2, rng, 10000 );
if( !found )
{
if( iter == 0 )