\n
int main() {\n cv::Mat img = cv::imread("input.png", cv::IMREAD_UNCHAGED);\n std::vector<int> ids;\n std::vector<std::vector<cv::Point2f> > corners;\n cv::Ptr<cv::aruco::Dictionary> dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_5X5_1000);\n cv::aruco::DetectorParameters detectorParams = cv::aruco::DetectorParameters();\n params.polygonalApproxAccuracyRate = 0.04 // I tried different values here\n params.maxMarkerPerimeterRate = 0.05 // here too\n params.minMarkerPerimeterRate = 0.06 // and here\n cv::aruco::ArucoDetector detector(dictionary, detectorParams);\n detector.detectMarkers(img, markerCorners, markerIds, rejectedCandidates);\n cv::aruco::drawDetectedMarkers(img, corners, ids);\n cv::write("output.png", img);\n return 0;\n}\n
\n","author":{"@type":"Person","name":"zeellos"},"upvoteCount":0,"answerCount":1,"acceptedAnswer":null}}Reputation: 137
I have this image where the marker with Id 67 is not properly detected (the corners are visibly underestimated). I can see there's room to find the corner but not sure why the Aruco detector does not like this marker. I tried to use polygonalApproxAccuracyRate and min/maxMarkerPerimeterRate but didn't have luck trying multiple combinations. If there's a missing knob I might not be considering I would appreciate any pointer. Also, not sure if there's a way to detect ocluded Arucos like the one under id=67.
int main() {
cv::Mat img = cv::imread("input.png", cv::IMREAD_UNCHAGED);
std::vector<int> ids;
std::vector<std::vector<cv::Point2f> > corners;
cv::Ptr<cv::aruco::Dictionary> dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_5X5_1000);
cv::aruco::DetectorParameters detectorParams = cv::aruco::DetectorParameters();
params.polygonalApproxAccuracyRate = 0.04 // I tried different values here
params.maxMarkerPerimeterRate = 0.05 // here too
params.minMarkerPerimeterRate = 0.06 // and here
cv::aruco::ArucoDetector detector(dictionary, detectorParams);
detector.detectMarkers(img, markerCorners, markerIds, rejectedCandidates);
cv::aruco::drawDetectedMarkers(img, corners, ids);
cv::write("output.png", img);
return 0;
}
Upvotes: 0
Views: 211
Reputation: 98
As a very temporary, low effort solution, try to pad your image with a few white pixels every side, creating an artificial quiet zone.
Upvotes: 0