ArUco changing used dictionary

asked 2017-03-30 14:15:38 -0600

Andak gravatar image

GoodEvening, I'm quite new to OpenCV and ArUco. I need to calibrate a camera, I read the example found in the ArUco Utils "aruco_calibration.cpp" Then I saw that the ARUCO_MIP_36h12 chessboard table is used. So I modified a simple program that recognize the default aruco markers in order to detect the ARUCO_MIP_36h12 markers.

In particular i just call the function setDictionary and then the detect function as before. If I do in this way off course the default markers are not recognized anymore, but the MIP_36h12 markers are not recognized also!

            MyDetector.setDictionary("ARUCO_MIP_36h12");
            MyDetector.detect(InImage, Markers, CamParam, MarkerSize);

So, Changing the dictionary used is sufficent to detect markers of another type? I'm missing something obvious?

I can provide a more complete code if necessary, or whatever you want. Just for sake of completeness, I used this method to generate markers of the new dictionary

Dictionary dict = aruco::Dictionary::load("ARUCO_MIP_36h12");
int pixSize = 75;

string dict_name = dict.getName();
std::transform(dict_name.begin(), dict_name.end(), dict_name.begin(), ::tolower);
for (auto m : dict.getMapCode()) {
    string number = std::to_string(m.second);
    while (number.size() != 5) number = "0" + number;
    stringstream name;
    name << "C:/Users/utente/Desktop/DIZIONARIO/" + dict_name + "_" << number << ".png";
    cout << name.str() << endl;
    cv::imwrite(name.str(), dict.getMarkerImage_id(m.second, pixSize));
}

In the selected folder I see all the markers so I think I'm doing this in the right way (brutal). Thanks in advance for your support, Have a nice day :)

edit retag flag offensive close merge delete

Comments

I have never done this but I think you need to adjust values given here. Why don't you use a regular charuco board like in this post?

LBerger gravatar imageLBerger ( 2017-03-30 14:36:00 -0600 )edit