Commit 03cd6072 authored by Ilya Lysenkov's avatar Ilya Lysenkov

Fixed the test of findChessboardCorners (it didn't test accuracy before)

parent a185302c
...@@ -137,13 +137,26 @@ const double precise_success_error_level = 2; ...@@ -137,13 +137,26 @@ const double precise_success_error_level = 2;
/* ///////////////////// chess_corner_test ///////////////////////// */ /* ///////////////////// chess_corner_test ///////////////////////// */
void CV_ChessboardDetectorTest::run( int /*start_from */) void CV_ChessboardDetectorTest::run( int /*start_from */)
{ {
cvtest::TS& ts = *this->ts;
ts.set_failed_test_info( cvtest::TS::OK );
/*if (!checkByGenerator()) /*if (!checkByGenerator())
return;*/ return;*/
switch( pattern ) switch( pattern )
{ {
case CHESSBOARD: case CHESSBOARD:
checkByGenerator(); checkByGenerator();
if (ts.get_err_code() != cvtest::TS::OK)
{
break;
}
run_batch("chessboard_list.dat"); run_batch("chessboard_list.dat");
if (ts.get_err_code() != cvtest::TS::OK)
{
break;
}
run_batch("chessboard_list_subpixel.dat"); run_batch("chessboard_list_subpixel.dat");
break; break;
case CIRCLES_GRID: case CIRCLES_GRID:
...@@ -158,7 +171,6 @@ void CV_ChessboardDetectorTest::run( int /*start_from */) ...@@ -158,7 +171,6 @@ void CV_ChessboardDetectorTest::run( int /*start_from */)
void CV_ChessboardDetectorTest::run_batch( const string& filename ) void CV_ChessboardDetectorTest::run_batch( const string& filename )
{ {
cvtest::TS& ts = *this->ts; cvtest::TS& ts = *this->ts;
ts.set_failed_test_info( cvtest::TS::OK );
ts.printf(cvtest::TS::LOG, "\nRunning batch %s\n", filename.c_str()); ts.printf(cvtest::TS::LOG, "\nRunning batch %s\n", filename.c_str());
//#define WRITE_POINTS 1 //#define WRITE_POINTS 1
...@@ -208,7 +220,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) ...@@ -208,7 +220,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
{ {
ts.printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", img_file.c_str() ); ts.printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", img_file.c_str() );
ts.set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA ); ts.set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA );
continue; return;
} }
string filename = folder + (string)board_list[idx * 2 + 1]; string filename = folder + (string)board_list[idx * 2 + 1];
...@@ -246,7 +258,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) ...@@ -246,7 +258,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
{ {
ts.printf( cvtest::TS::LOG, "chessboard is not found in %s\n", img_file.c_str() ); ts.printf( cvtest::TS::LOG, "chessboard is not found in %s\n", img_file.c_str() );
ts.set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT ); ts.set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
continue; return;
} }
#ifndef WRITE_POINTS #ifndef WRITE_POINTS
...@@ -276,7 +288,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) ...@@ -276,7 +288,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
{ {
ts.printf( cvtest::TS::LOG, "Image %s: bad accuracy of adjusted corners %f\n", img_file.c_str(), err ); ts.printf( cvtest::TS::LOG, "Image %s: bad accuracy of adjusted corners %f\n", img_file.c_str(), err );
ts.set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY ); ts.set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
continue; return;
} }
#endif #endif
ts.printf(cvtest::TS::LOG, "Error on %s is %f\n", img_file.c_str(), err); ts.printf(cvtest::TS::LOG, "Error on %s is %f\n", img_file.c_str(), err);
...@@ -392,7 +404,7 @@ bool CV_ChessboardDetectorTest::checkByGenerator() ...@@ -392,7 +404,7 @@ bool CV_ChessboardDetectorTest::checkByGenerator()
ts->printf( cvtest::TS::LOG, "Chess board corners not found\n" ); ts->printf( cvtest::TS::LOG, "Chess board corners not found\n" );
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY ); ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
res = false; res = false;
continue; return res;
} }
double err = calcErrorMinError(cbg.cornersSize(), corners_found, corners_generated); double err = calcErrorMinError(cbg.cornersSize(), corners_found, corners_generated);
...@@ -401,7 +413,7 @@ bool CV_ChessboardDetectorTest::checkByGenerator() ...@@ -401,7 +413,7 @@ bool CV_ChessboardDetectorTest::checkByGenerator()
ts->printf( cvtest::TS::LOG, "bad accuracy of corner guesses" ); ts->printf( cvtest::TS::LOG, "bad accuracy of corner guesses" );
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY ); ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
res = false; res = false;
continue; return res;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment