@@ -538,15 +538,55 @@ void CV_CharucoDiamondDetection::run(int) {
538
538
}
539
539
}
540
540
541
+ /* *
542
+ * @brief Check charuco board creation
543
+ */
544
+ class CV_CharucoBoardCreation : public cvtest ::BaseTest {
545
+ public:
546
+ CV_CharucoBoardCreation ();
541
547
548
+ protected:
549
+ void run (int );
550
+ };
551
+
552
+ CV_CharucoBoardCreation::CV_CharucoBoardCreation () {}
553
+
554
+ void CV_CharucoBoardCreation::run (int )
555
+ {
556
+ Ptr<aruco::Dictionary> dictionary = aruco::getPredefinedDictionary (aruco::DICT_5X5_250);
557
+ int n = 6 ;
558
+
559
+ float markerSizeFactor = 0 .5f ;
560
+
561
+ for (float squareSize_mm = 5 .0f ; squareSize_mm < 35 .0f ; squareSize_mm += 0 .1f )
562
+ {
563
+ Ptr<aruco::CharucoBoard> board_meters = aruco::CharucoBoard::create (
564
+ n, n, squareSize_mm*1e-3f , squareSize_mm * markerSizeFactor * 1e-3f , dictionary);
565
+
566
+ Ptr<aruco::CharucoBoard> board_millimeters = aruco::CharucoBoard::create (
567
+ n, n, squareSize_mm, squareSize_mm * markerSizeFactor, dictionary);
568
+
569
+ for (size_t i = 0 ; i < board_meters->nearestMarkerIdx .size (); i++)
570
+ {
571
+ if (board_meters->nearestMarkerIdx [i].size () != board_millimeters->nearestMarkerIdx [i].size () ||
572
+ board_meters->nearestMarkerIdx [i][0 ] != board_millimeters->nearestMarkerIdx [i][0 ])
573
+ {
574
+ ts->printf (cvtest::TS::LOG,
575
+ cv::format (" Charuco board topology is sensitive to scale with squareSize=%.1f\n " ,
576
+ squareSize_mm).c_str ());
577
+ ts->set_failed_test_info (cvtest::TS::FAIL_INVALID_OUTPUT);
578
+ break ;
579
+ }
580
+ }
581
+ }
582
+ }
542
583
543
584
544
585
TEST (CV_CharucoDetection, accuracy) {
545
586
CV_CharucoDetection test;
546
587
test.safe_run ();
547
588
}
548
589
549
-
550
590
TEST (CV_CharucoPoseEstimation, accuracy) {
551
591
CV_CharucoPoseEstimation test;
552
592
test.safe_run ();
@@ -557,4 +597,9 @@ TEST(CV_CharucoDiamondDetection, accuracy) {
557
597
test.safe_run ();
558
598
}
559
599
600
+ TEST (CV_CharucoBoardCreation, accuracy) {
601
+ CV_CharucoBoardCreation test;
602
+ test.safe_run ();
603
+ }
604
+
560
605
}} // namespace
0 commit comments