zeellos
zeellos

Reputation: 137

Fail to detect Aruco markers at the edges

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.

Aruco detection

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

Answers (1)

H_Barrio
H_Barrio

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

Related Questions