diff --git a/modules/calib3d/src/chessboard.cpp b/modules/calib3d/src/chessboard.cpp index 1801a1cbf4..ffbddadf40 100644 --- a/modules/calib3d/src/chessboard.cpp +++ b/modules/calib3d/src/chessboard.cpp @@ -1625,36 +1625,30 @@ bool Chessboard::Board::normalizeMarkerOrientation() if(!current_cell->marker || !current_cell->right || !current_cell->right->marker) continue; - if(current_cell->black) + if(current_cell->right->top && current_cell->right->top->marker) { - if(current_cell->right->top && current_cell->right->top->marker) - { - rotateLeft(); - rotateLeft(); - pcell = current_cell->right; - break; - } - if(current_cell->right->bottom && current_cell->right->bottom->marker) - { - rotateLeft(); - pcell = current_cell->right; - break; - } + rotateLeft(); + rotateLeft(); + pcell = current_cell->right; + break; } - else + if(current_cell->right->bottom && current_cell->right->bottom->marker) { - if(current_cell->top && current_cell->top->marker) - { - rotateRight(); - pcell = current_cell; - break; - } - if(current_cell->bottom && current_cell->bottom->marker) - { - // correct orientation - pcell = current_cell; - break; - } + rotateLeft(); + pcell = current_cell->right; + break; + } + if(current_cell->top && current_cell->top->marker) + { + rotateRight(); + pcell = current_cell; + break; + } + if(current_cell->bottom && current_cell->bottom->marker) + { + // correct orientation + pcell = current_cell; + break; } } } diff --git a/modules/calib3d/test/test_chesscorners.cpp b/modules/calib3d/test/test_chesscorners.cpp index a63d5b3e83..3d13602780 100644 --- a/modules/calib3d/test/test_chesscorners.cpp +++ b/modules/calib3d/test/test_chesscorners.cpp @@ -679,6 +679,26 @@ TEST(Calib3d_AsymmetricCirclesPatternDetector, accuracy) { CV_ChessboardDetector TEST(Calib3d_AsymmetricCirclesPatternDetectorWithClustering, accuracy) { CV_ChessboardDetectorTest test( ASYMMETRIC_CIRCLES_GRID, CALIB_CB_CLUSTERING ); test.safe_run(); } #endif +TEST(Calib3d_ChessboardWithMarkers, regression_25806_white) +{ + const cv::String dataDir = string(TS::ptr()->get_data_path()) + "cv/cameracalibration/"; + const cv::Mat image = cv::imread(dataDir + "checkerboard_marker_white.png"); + + std::vector corners; + const bool success = cv::findChessboardCornersSB(image, Size(9, 14), corners, CALIB_CB_MARKER); + ASSERT_TRUE(success); +} + +TEST(Calib3d_ChessboardWithMarkers, regression_25806_black) +{ + const cv::String dataDir = string(TS::ptr()->get_data_path()) + "cv/cameracalibration/"; + const cv::Mat image = cv::imread(dataDir + "checkerboard_marker_black.png"); + + std::vector corners; + const bool success = cv::findChessboardCornersSB(image, Size(9, 14), corners, CALIB_CB_MARKER); + ASSERT_TRUE(success); +} + TEST(Calib3d_CirclesPatternDetectorWithClustering, accuracy) { cv::String dataDir = string(TS::ptr()->get_data_path()) + "cv/cameracalibration/circles/";