diff --git a/modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp b/modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp index 0f64d45aa0..f885a2af87 100644 --- a/modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp +++ b/modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp @@ -34,7 +34,7 @@ struct CV_EXPORTS_W_SIMPLE DetectorParameters { minCornerDistanceRate = 0.05; minDistanceToBorder = 3; minMarkerDistanceRate = 0.05; - cornerRefinementMethod = CORNER_REFINE_NONE; + cornerRefinementMethod = (int)CORNER_REFINE_NONE; cornerRefinementWinSize = 5; cornerRefinementMaxIterations = 30; cornerRefinementMinAccuracy = 0.1; @@ -106,7 +106,7 @@ struct CV_EXPORTS_W_SIMPLE DetectorParameters { CV_PROP_RW double minMarkerDistanceRate; /** @brief default value CORNER_REFINE_NONE */ - CV_PROP_RW CornerRefineMethod cornerRefinementMethod; + CV_PROP_RW int cornerRefinementMethod; /// window size for the corner refinement process (in pixels) (default 5). CV_PROP_RW int cornerRefinementWinSize; diff --git a/modules/objdetect/perf/perf_aruco.cpp b/modules/objdetect/perf/perf_aruco.cpp index d3f9141a21..593fc3c275 100644 --- a/modules/objdetect/perf/perf_aruco.cpp +++ b/modules/objdetect/perf/perf_aruco.cpp @@ -171,7 +171,7 @@ PERF_TEST_P(EstimateAruco, ArucoFirst, ESTIMATE_PARAMS) { aruco::DetectorParameters detectorParams; detectorParams.minDistanceToBorder = 1; detectorParams.markerBorderBits = 1; - detectorParams.cornerRefinementMethod = cv::aruco::CORNER_REFINE_SUBPIX; + detectorParams.cornerRefinementMethod = (int)cv::aruco::CORNER_REFINE_SUBPIX; const int markerSize = 100; const int numMarkersInRow = 9; @@ -203,7 +203,7 @@ PERF_TEST_P(EstimateAruco, ArucoSecond, ESTIMATE_PARAMS) { aruco::DetectorParameters detectorParams; detectorParams.minDistanceToBorder = 1; detectorParams.markerBorderBits = 1; - detectorParams.cornerRefinementMethod = cv::aruco::CORNER_REFINE_SUBPIX; + detectorParams.cornerRefinementMethod = (int)cv::aruco::CORNER_REFINE_SUBPIX; //USE_ARUCO3 detectorParams.useAruco3Detection = get<0>(testParams); @@ -255,7 +255,7 @@ PERF_TEST_P(EstimateLargeAruco, ArucoFHD, ESTIMATE_FHD_PARAMS) { aruco::DetectorParameters detectorParams; detectorParams.minDistanceToBorder = 1; detectorParams.markerBorderBits = 1; - detectorParams.cornerRefinementMethod = cv::aruco::CORNER_REFINE_SUBPIX; + detectorParams.cornerRefinementMethod = (int)cv::aruco::CORNER_REFINE_SUBPIX; //USE_ARUCO3 detectorParams.useAruco3Detection = get<0>(testParams).useAruco3Detection; diff --git a/modules/objdetect/src/aruco/aruco_detector.cpp b/modules/objdetect/src/aruco/aruco_detector.cpp index 30ffbd3cb3..395bb49338 100644 --- a/modules/objdetect/src/aruco/aruco_detector.cpp +++ b/modules/objdetect/src/aruco/aruco_detector.cpp @@ -881,7 +881,7 @@ void ArucoDetector::detectMarkers(InputArray _image, OutputArrayOfArrays _corner } else { // always turn on corner refinement in case of Aruco3, due to upsampling - detectorParams.cornerRefinementMethod = CORNER_REFINE_SUBPIX; + detectorParams.cornerRefinementMethod = (int)CORNER_REFINE_SUBPIX; // only CORNER_REFINE_SUBPIX implement correctly for useAruco3Detection // Todo: update other CORNER_REFINE methods } @@ -923,7 +923,7 @@ void ArucoDetector::detectMarkers(InputArray _image, OutputArrayOfArrays _corner vector > > contoursSet; /// STEP 2.a Detect marker candidates :: using AprilTag - if(detectorParams.cornerRefinementMethod == CORNER_REFINE_APRILTAG){ + if(detectorParams.cornerRefinementMethod == (int)CORNER_REFINE_APRILTAG){ _apriltag(grey, detectorParams, candidates, contours); candidatesSet.push_back(candidates); @@ -938,7 +938,7 @@ void ArucoDetector::detectMarkers(InputArray _image, OutputArrayOfArrays _corner candidates, contours, ids, detectorParams, _rejectedImgPoints); /// STEP 3: Corner refinement :: use corner subpix - if (detectorParams.cornerRefinementMethod == CORNER_REFINE_SUBPIX) { + if (detectorParams.cornerRefinementMethod == (int)CORNER_REFINE_SUBPIX) { CV_Assert(detectorParams.cornerRefinementWinSize > 0 && detectorParams.cornerRefinementMaxIterations > 0 && detectorParams.cornerRefinementMinAccuracy > 0); // Do subpixel estimation. In Aruco3 start on the lowest pyramid level and upscale the corners @@ -963,7 +963,7 @@ void ArucoDetector::detectMarkers(InputArray _image, OutputArrayOfArrays _corner } /// STEP 3, Optional : Corner refinement :: use contour container - if (detectorParams.cornerRefinementMethod == CORNER_REFINE_CONTOUR){ + if (detectorParams.cornerRefinementMethod == (int)CORNER_REFINE_CONTOUR){ if (!ids.empty()) { @@ -976,7 +976,7 @@ void ArucoDetector::detectMarkers(InputArray _image, OutputArrayOfArrays _corner } } - if (detectorParams.cornerRefinementMethod != CORNER_REFINE_SUBPIX && fxfy != 1.f) { + if (detectorParams.cornerRefinementMethod != (int)CORNER_REFINE_SUBPIX && fxfy != 1.f) { // only CORNER_REFINE_SUBPIX implement correctly for useAruco3Detection // Todo: update other CORNER_REFINE methods @@ -1213,7 +1213,7 @@ void ArucoDetector::refineDetectedMarkers(InputArray _image, const Board& _board if(closestCandidateIdx >= 0) { // subpixel refinement - if(detectorParams.cornerRefinementMethod == CORNER_REFINE_SUBPIX) { + if(detectorParams.cornerRefinementMethod == (int)CORNER_REFINE_SUBPIX) { CV_Assert(detectorParams.cornerRefinementWinSize > 0 && detectorParams.cornerRefinementMaxIterations > 0 && detectorParams.cornerRefinementMinAccuracy > 0); diff --git a/modules/objdetect/test/test_arucodetection.cpp b/modules/objdetect/test/test_arucodetection.cpp index 5d20cd4fd3..9cb6f07b33 100644 --- a/modules/objdetect/test/test_arucodetection.cpp +++ b/modules/objdetect/test/test_arucodetection.cpp @@ -268,12 +268,12 @@ void CV_ArucoDetectionPerspective::run(int) { } if(ArucoAlgParams::USE_APRILTAG == arucoAlgParams){ - detectorParameters.cornerRefinementMethod = aruco::CORNER_REFINE_APRILTAG; + detectorParameters.cornerRefinementMethod = (int)aruco::CORNER_REFINE_APRILTAG; } if (ArucoAlgParams::USE_ARUCO3 == arucoAlgParams) { detectorParameters.useAruco3Detection = true; - detectorParameters.cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; + detectorParameters.cornerRefinementMethod = (int)aruco::CORNER_REFINE_SUBPIX; } detector.setDetectorParameters(detectorParameters); @@ -653,7 +653,7 @@ TEST_P(ArucoThreading, number_of_threads_does_not_change_results) img_marker.copyTo(img(Rect(shift, shift, height_marker, height_marker))); aruco::DetectorParameters detectorParameters = detector.getDetectorParameters(); - detectorParameters.cornerRefinementMethod = GetParam(); + detectorParameters.cornerRefinementMethod = (int)GetParam(); detector.setDetectorParameters(detectorParameters); vector > original_corners; diff --git a/modules/objdetect/test/test_boarddetection.cpp b/modules/objdetect/test/test_boarddetection.cpp index ed940069fb..e47e6c3cb6 100644 --- a/modules/objdetect/test/test_boarddetection.cpp +++ b/modules/objdetect/test/test_boarddetection.cpp @@ -26,7 +26,7 @@ class CV_ArucoBoardPose : public cvtest::BaseTest { params.minDistanceToBorder = 3; if (arucoAlgParams == ArucoAlgParams::USE_ARUCO3) { params.useAruco3Detection = true; - params.cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; + params.cornerRefinementMethod = (int)aruco::CORNER_REFINE_SUBPIX; params.minSideLengthCanonicalImg = 16; params.errorCorrectionRate = 0.8; } @@ -137,7 +137,7 @@ class CV_ArucoRefine : public cvtest::BaseTest { aruco::Dictionary dictionary = aruco::getPredefinedDictionary(aruco::DICT_6X6_250); aruco::DetectorParameters params; params.minDistanceToBorder = 3; - params.cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; + params.cornerRefinementMethod = (int)aruco::CORNER_REFINE_SUBPIX; if (arucoAlgParams == ArucoAlgParams::USE_ARUCO3) params.useAruco3Detection = true; aruco::RefineParameters refineParams(10.f, 3.f, true); diff --git a/modules/objdetect/test/test_charucodetection.cpp b/modules/objdetect/test/test_charucodetection.cpp index 87d2f12b02..3a459e11fc 100644 --- a/modules/objdetect/test/test_charucodetection.cpp +++ b/modules/objdetect/test/test_charucodetection.cpp @@ -612,7 +612,7 @@ TEST(Charuco, testBoardSubpixelCoords) cv::GaussianBlur(gray, gray, Size(5, 5), 1.0); aruco::DetectorParameters params; - params.cornerRefinementMethod = cv::aruco::CORNER_REFINE_APRILTAG; + params.cornerRefinementMethod = (int)cv::aruco::CORNER_REFINE_APRILTAG; aruco::CharucoParameters charucoParameters; charucoParameters.cameraMatrix = K; @@ -636,7 +636,7 @@ TEST(Charuco, issue_14014) Mat img = imread(imgPath); aruco::DetectorParameters detectorParams; - detectorParams.cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; + detectorParams.cornerRefinementMethod = (int)aruco::CORNER_REFINE_SUBPIX; detectorParams.cornerRefinementMinAccuracy = 0.01; aruco::ArucoDetector detector(aruco::getPredefinedDictionary(aruco::DICT_7X7_250), detectorParams); aruco::CharucoBoard board(Size(8, 5), 0.03455f, 0.02164f, detector.getDictionary());