Skip to content

Commit d7d9013

Browse files
committed
* Adding link and brief description to legacy parameter
* Exchange test condition blocks with ASSERTs
1 parent 5abd393 commit d7d9013

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

modules/aruco/include/opencv2/aruco/charuco.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
9292
* @param markerLength marker side length (same unit than squareLength)
9393
* @param dictionary dictionary of markers indicating the type of markers.
9494
* The first markers in the dictionary are used to fill the white chessboard squares.
95-
* @param legacy legacy chessboard pattern (pre 4.6.0)
95+
* @param legacy legacy chessboard pattern (pre 4.6.0). Pattern generation was changed to be consistent across OpenCV, leading to incompatible even row patterns. Legacy switch enables old behavior to support pre-existing targets, see https://github.com/opencv/opencv_contrib/issues/3291).
9696
* @return the output CharucoBoard object
9797
*
9898
* This functions creates a CharucoBoard object given the number of squares in each direction

modules/aruco/test/test_charucodetection.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ void CV_CharucoDetection::run(int) {
166166
params->markerBorderBits = markerBorder;
167167
aruco::detectMarkers(img, dictionary, corners, ids, params);
168168

169-
if(ids.size() == 0) {
170-
ts->printf(cvtest::TS::LOG, "Marker detection failed");
171-
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
172-
return;
173-
}
169+
ASSERT_GT(ids.size(), std::vector< int >::size_type(0)) << "Marker detection failed";
174170

175171
// interpolate charuco corners
176172
vector< Point2f > charucoCorners;
@@ -321,20 +317,11 @@ void CV_CharucoPoseEstimation::run(int) {
321317

322318
int currentId = charucoIds[i];
323319

324-
if(currentId >= (int)board->chessboardCorners.size()) {
325-
ts->printf(cvtest::TS::LOG, "Invalid Charuco corner id");
326-
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
327-
return;
328-
}
320+
ASSERT_LT(currentId, (int)board->chessboardCorners.size()) << "Invalid Charuco corner id";
329321

330322
double repError = cv::norm(charucoCorners[i] - projectedCharucoCorners[currentId]); // TODO cvtest
331323

332-
333-
if(repError > 5.) {
334-
ts->printf(cvtest::TS::LOG, "Charuco corner reprojection error too high");
335-
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
336-
return;
337-
}
324+
ASSERT_LE(repError, 5.) << "Charuco corner reprojection error too high";
338325
}
339326
}
340327
}

0 commit comments

Comments
 (0)