Ask Your Question

Martinator's profile - activity

2018-12-01 21:05:08 -0600 received badge  Teacher (source)
2016-04-18 03:39:11 -0600 received badge  Self-Learner (source)
2016-04-17 09:21:17 -0600 answered a question Valid marker ends up in rejected candidates with aruco marker detection

Hello, the problem I had was, that the dictionary has changed and that the tutorial markers are no longer used. The tutorial marker with id 23 was different from the one generated from the new dictionary. The solution is to only use markers generated using the drawMarker function.

image description

It was a stupid mistake but it just goes to show that one should not rely on old tutorials. OpenCV cnd its modules change really fast.

2016-04-08 08:19:46 -0600 commented question Valid marker ends up in rejected candidates with aruco marker detection

Hello, I will try, but as far as I understand, once the corners are found, the marker image will be cut out using these corners from the original and then thresholded with Otsu threshold so the letters there should not interfere with the process.

I guess the culprid should be somewhere in the bit detection process.

2016-04-06 23:05:00 -0600 asked a question Valid marker ends up in rejected candidates with aruco marker detection

Hello, I am trying to test the basic functionalities with aruco. I have two problems. I am getting an numpad_chunk() : invalid pointer error when the program ends (which is bad, but bearable). The second problem is that I can not detect the marker from the tutorial and it is found in the rejected candidates output. I have used the same dictionary as in the tutorial. What is the problem? My code is in c++ as follows:

#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/videoio/videoio.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/aruco.hpp"
#include <vector>

using namespace cv;
using namespace std;

int main (int argc, char** argv)
{
    VideoCapture cap;

    if(!cap.open(0)){
        return 0;
    }
    aruco::DetectorParameters parameters;
    aruco::Dictionary dictionary = aruco::getPredefinedDictionary(aruco::DICT_6X6_250);
    Ptr<aruco::Dictionary> dictionaryPtr(&dictionary) ;
    Ptr<aruco::DetectorParameters> parametersPtr(&parameters);
    for(;;){
        Mat inputImage;
        cap >> inputImage;
        vector< int > markerIds;
        vector< vector<Point2f> > markerCorners, rejectedCandidates;
        aruco::detectMarkers(inputImage, dictionaryPtr, markerCorners, markerIds, parametersPtr, rejectedCandidates);

        Mat outputImage = inputImage.clone(); 
        aruco::drawDetectedMarkers(outputImage, markerCorners, markerIds);
        cout << rejectedCandidates.size() << endl;
        for(std::vector< vector<Point2f> >::iterator it = rejectedCandidates.begin(); it != rejectedCandidates.end(); ++it) {
            vector<Point2f> sqPoints = *it;
            //cout << sqPoints.size() << endl;
            //Point pt2(it[1].x, it[1].y);
            line(outputImage, sqPoints[0], sqPoints[1], CV_RGB(255, 0 , 0));
            line(outputImage, sqPoints[2], sqPoints[1], CV_RGB(255, 0 , 0));
            line(outputImage, sqPoints[2], sqPoints[3], CV_RGB(255, 0 , 0));
            line(outputImage, sqPoints[0], sqPoints[3], CV_RGB(255, 0 , 0));
        }
        if(inputImage.empty()) break;
        imshow("Webcam", outputImage);
        if(waitKey(1) >= 0) break;
    }
    dictionaryPtr.release();
    parametersPtr.release();
    return 0;
}

Here is a screenshot of what I am getting as output (I draw all rejected candidates with a red outline):

image description

Any help would be appreciated.