Added tests of findCirclesGrid() with the asymmetric pattern.
This commit is contained in:
@@ -74,23 +74,25 @@ void show_points( const Mat& gray, const Mat& u, const vector<Point2f>& v, Size
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum Pattern { CHESSBOARD, CIRCLES_GRID };
|
enum Pattern { CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };
|
||||||
|
|
||||||
class CV_ChessboardDetectorTest : public cvtest::BaseTest
|
class CV_ChessboardDetectorTest : public cvtest::BaseTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CV_ChessboardDetectorTest( Pattern pattern );
|
CV_ChessboardDetectorTest( Pattern pattern, int algorithmFlags = 0 );
|
||||||
protected:
|
protected:
|
||||||
void run(int);
|
void run(int);
|
||||||
void run_batch(const string& filename);
|
void run_batch(const string& filename);
|
||||||
bool checkByGenerator();
|
bool checkByGenerator();
|
||||||
|
|
||||||
Pattern pattern;
|
Pattern pattern;
|
||||||
|
int algorithmFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
CV_ChessboardDetectorTest::CV_ChessboardDetectorTest( Pattern _pattern )
|
CV_ChessboardDetectorTest::CV_ChessboardDetectorTest( Pattern _pattern, int _algorithmFlags )
|
||||||
{
|
{
|
||||||
pattern = _pattern;
|
pattern = _pattern;
|
||||||
|
algorithmFlags = _algorithmFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
double calcError(const vector<Point2f>& v, const Mat& u)
|
double calcError(const vector<Point2f>& v, const Mat& u)
|
||||||
@@ -147,6 +149,9 @@ void CV_ChessboardDetectorTest::run( int /*start_from */)
|
|||||||
case CIRCLES_GRID:
|
case CIRCLES_GRID:
|
||||||
run_batch("circles_list.dat");
|
run_batch("circles_list.dat");
|
||||||
break;
|
break;
|
||||||
|
case ASYMMETRIC_CIRCLES_GRID:
|
||||||
|
run_batch("acircles_list.dat");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +174,9 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
|
|||||||
case CIRCLES_GRID:
|
case CIRCLES_GRID:
|
||||||
folder = string(ts.get_data_path()) + "cameracalibration/circles/";
|
folder = string(ts.get_data_path()) + "cameracalibration/circles/";
|
||||||
break;
|
break;
|
||||||
|
case ASYMMETRIC_CIRCLES_GRID:
|
||||||
|
folder = string(ts.get_data_path()) + "cameracalibration/asymmetric_circles/";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStorage fs( folder + filename, FileStorage::READ );
|
FileStorage fs( folder + filename, FileStorage::READ );
|
||||||
@@ -229,6 +237,9 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
|
|||||||
case CIRCLES_GRID:
|
case CIRCLES_GRID:
|
||||||
result = findCirclesGrid(gray, pattern_size, v);
|
result = findCirclesGrid(gray, pattern_size, v);
|
||||||
break;
|
break;
|
||||||
|
case ASYMMETRIC_CIRCLES_GRID:
|
||||||
|
result = findCirclesGrid(gray, pattern_size, v, CALIB_CB_ASYMMETRIC_GRID | algorithmFlags);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
show_points( gray, Mat(), v, pattern_size, result );
|
show_points( gray, Mat(), v, pattern_size, result );
|
||||||
if( !result || v.size() != count_exp )
|
if( !result || v.size() != count_exp )
|
||||||
@@ -439,5 +450,7 @@ bool CV_ChessboardDetectorTest::checkByGenerator()
|
|||||||
|
|
||||||
TEST(Calib3d_ChessboardDetector, accuracy) { CV_ChessboardDetectorTest test( CHESSBOARD ); test.safe_run(); }
|
TEST(Calib3d_ChessboardDetector, accuracy) { CV_ChessboardDetectorTest test( CHESSBOARD ); test.safe_run(); }
|
||||||
TEST(Calib3d_CirclesPatternDetector, accuracy) { CV_ChessboardDetectorTest test( CIRCLES_GRID ); test.safe_run(); }
|
TEST(Calib3d_CirclesPatternDetector, accuracy) { CV_ChessboardDetectorTest test( CIRCLES_GRID ); test.safe_run(); }
|
||||||
|
TEST(Calib3d_AsymmetricCirclesPatternDetector, accuracy) { CV_ChessboardDetectorTest test( ASYMMETRIC_CIRCLES_GRID ); test.safe_run(); }
|
||||||
|
TEST(Calib3d_AsymmetricCirclesPatternDetectorWithClustering, accuracy) { CV_ChessboardDetectorTest test( ASYMMETRIC_CIRCLES_GRID, CALIB_CB_CLUSTERING ); test.safe_run(); }
|
||||||
|
|
||||||
/* End of file. */
|
/* End of file. */
|
||||||
|
Reference in New Issue
Block a user