1

I implemented ArUco module in opencv3.0 it works completely fine while detecting aruco markers.

For aruco marker detection i am using this image

enter image description here

But is it possible to detect normal markers like this below image using aruco module?

enter image description here

Here is some snippets of my code:

aruco::DetectorParameters detectorParams;
if (parser.has("dp")) {
bool readOk = readDetectorParameters(parser.get<string>("dp"), detectorParams);
    if (!readOk) {
        cerr << "Invalid detector parameters file" << endl;
        return 0;
    }
}

aruco::Dictionary dictionary =
    aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME(dictionaryId));

Mat camMatrix, distCoeffs;
if (estimatePose) {
    bool readOk = readCameraParameters(parser.get<string>("c"), camMatrix, distCoeffs);
    if (!readOk) {
        cerr << "Invalid camera file" << endl;
        return 0;
    }
}

// detect markers and estimate pose
    aruco::detectMarkers(image, dictionary, corners, ids, detectorParams, rejected);
    if (estimatePose && ids.size() > 0)
        aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,
            tvecs);

// draw results
    image.copyTo(imageCopy);
    if (ids.size() > 0) {
        aruco::drawDetectedMarkers(imageCopy, corners, ids);

        if (estimatePose) {
            for (unsigned int i = 0; i < ids.size(); i++)
                aruco::drawAxis(imageCopy, camMatrix, distCoeffs, rvecs[i], tvecs[i],
                    markerLength * 0.5f);
        }
    }

    if (showRejected && rejected.size() > 0)
        aruco::drawDetectedMarkers(imageCopy, rejected, noArray(), Scalar(100, 0, 255));

    imshow("out", imageCopy);
    char key = (char)waitKey(waitTime);
    if (key == 27) break;
}

How can i make this code to detect normal markers?

MarKS
  • 494
  • 6
  • 22
  • Probably you can generate your own dictionary ([faq](http://docs.opencv.org/master/d1/dcb/tutorial_aruco_faq.html#gsc.tab=0)) – Miki Jan 16 '16 at 17:19

1 Answers1

1

In the FAQ

Should I use a predefined dictionary or generate my own dictionary?

In general, it is easier to use one of the predefined dictionaries. However, if you need a bigger dictionary (in terms of number of markers or number of bits) you should generate your own dictionary. Dictionary generation is also useful if you want to maximize the inter-marker distance to achieve a better error correction during the identification step.

I think this is exactly your case, you want to use something that isn't in the standard ArUco Dictionary. A dictionary is simply a class, you need to create one and fill it with the correct data.

GPPK
  • 6,546
  • 4
  • 32
  • 57