Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Detecting patches using ORB algorithm

Hi everybody!

I'm here because I'm working on a personal project about artificial vision. My idea is to write a program that can recognize a colored patch with a special shape in real time.

I've tried some different algorithms to accomplish this, but all that I've tried gave me unexpected results. I've tried with SIFT, Template Matching and ORB algorithms, and the only one who work was ORB.

With ORB I get this result:

image description

As you can see in the image above, I found a lot of keypoints in the right image, and a lot of (more) keypoints in the left image (video). Also, behind of me (the guy in the image :P), there are some keypoints that match exactly with the patch in the right image.

I think that I'm missing something with this. I'm a newbie with artificial vision and opencv in general. So, if someone can help me with this, or can show me a tutorial or another method to achieve this, I'll be very very grateful.

Some of the code of my program:

ORB orb = ORB();
orb.detect(mytemplate, keypoints_object, Mat());
orb.compute(mytemplate, keypoints_object, descriptors_object);
BFMatcher matcher(NORM_HAMMING2, false);
while (true)
{
    //step 3:
    capture >> frame;
    if (frame.empty())
    {
        break;
    }
    cvtColor(frame, frame, CV_RGB2GRAY);

    //step 4:
    orb.detect(frame, keypoints_frame, Mat());
    orb.compute(frame, keypoints_frame, descriptors_frame);

    //step 5:
    if (!descriptors_frame.empty() && !descriptors_object.empty())
    {
        matcher.match(descriptors_frame, descriptors_object, match);
        //step 6:
        drawMatches(frame, keypoints_frame, mytemplate, keypoints_object,
                match, output);
        std::cout << "entro!!" << endl;
    }
}

Some useful information: I'm using OpenCV 2.4.8 on Ubuntu 12.04.

Sorry my english, is not my native language :)

Thanks in advance!

Diego.