Merge pull request #18955 from alalek:test_debug_flag

This commit is contained in:
Alexander Alekhin 2020-12-04 18:09:59 +00:00
commit 12a36b5a94
5 changed files with 21 additions and 6 deletions

View File

@ -153,9 +153,8 @@ void CV_ChessboardSubpixelTest::run( int )
vector<Point2f> test_corners;
bool result = findChessboardCorners(chessboard_image, pattern_size, test_corners, 15);
if(!result)
if (!result && cvtest::debugLevel > 0)
{
#if 0
ts->printf(cvtest::TS::LOG, "Warning: chessboard was not detected! Writing image to test.png\n");
ts->printf(cvtest::TS::LOG, "Size = %d, %d\n", pattern_size.width, pattern_size.height);
ts->printf(cvtest::TS::LOG, "Intrinsic params: fx = %f, fy = %f, cx = %f, cy = %f\n",
@ -167,7 +166,9 @@ void CV_ChessboardSubpixelTest::run( int )
distortion_coeffs_.at<double>(0, 4));
imwrite("test.png", chessboard_image);
#endif
}
if (!result)
{
continue;
}

View File

@ -449,7 +449,10 @@ TEST_F(fisheyeTest, stereoRectify)
<< "Q =" << std::endl << Q << std::endl;
}
#if 1 // Debug code
if (cvtest::debugLevel == 0)
return;
// DEBUG code is below
cv::Mat lmapx, lmapy, rmapx, rmapy;
//rewrite for fisheye
cv::fisheye::initUndistortRectifyMap(K1, D1, R1, P1, requested_size, CV_32F, lmapx, lmapy);
@ -482,7 +485,6 @@ TEST_F(fisheyeTest, stereoRectify)
cv::imwrite(cv::format("fisheye_rectification_AB_%03d.png", i), rectification);
}
#endif
}
TEST_F(fisheyeTest, stereoCalibrate)

View File

@ -487,7 +487,8 @@ protected:
img->copyTo(sub);
shift += img->size().height + 1;
}
//imwrite("/tmp/all_fonts.png", result);
if (cvtest::debugLevel > 0)
imwrite("all_fonts.png", result);
}
};

View File

@ -13,6 +13,7 @@ void checkIppStatus();
extern bool skipUnstableTests;
extern bool runBigDataTests;
extern int testThreads;
extern int debugLevel; //< 0 - no debug, 1 - basic test debug information, >1 - extra debug information
void testSetUp();
void testTearDown();

View File

@ -774,6 +774,7 @@ static bool checkTestData = cv::utils::getConfigurationParameterBool("OPENCV_TES
bool skipUnstableTests = false;
bool runBigDataTests = false;
int testThreads = 0;
int debugLevel = (int)cv::utils::getConfigurationParameterSizeT("OPENCV_TEST_DEBUG", 0);
static size_t memory_usage_base = 0;
@ -883,6 +884,7 @@ void parseCustomOptions(int argc, char **argv)
"{ test_threads |-1 |the number of worker threads, if parallel execution is enabled}"
"{ skip_unstable |false |skip unstable tests }"
"{ test_bigdata |false |run BigData tests (>=2Gb) }"
"{ test_debug | |0 - no debug (default), 1 - basic test debug information, >1 - extra debug information }"
"{ test_require_data |") + (checkTestData ? "true" : "false") + string("|fail on missing non-required test data instead of skip (env:OPENCV_TEST_REQUIRE_DATA)}"
CV_TEST_TAGS_PARAMS
"{ h help |false |print help info }"
@ -909,6 +911,14 @@ void parseCustomOptions(int argc, char **argv)
skipUnstableTests = parser.get<bool>("skip_unstable");
runBigDataTests = parser.get<bool>("test_bigdata");
if (parser.has("test_debug"))
{
cv::String s = parser.get<cv::String>("test_debug");
if (s.empty() || s == "true")
debugLevel = 1;
else
debugLevel = parser.get<int>("test_debug");
}
if (parser.has("test_require_data"))
checkTestData = parser.get<bool>("test_require_data");