Ask Your Question

Detecting patches using ORB algorithm

asked 2014-05-16 22:14:03 -0500

adiego73 gravatar image

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())
    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!


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-17 05:00:58 -0500

yes123 gravatar image

If you need to detect a particular shape then keypoints (ORB, SIFT etc) won't help you.
You need something like countour matching and/or shape analysis.

Keypoints are good when you need to detect a planar object with at least some details within.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-05-16 22:14:03 -0500

Seen: 692 times

Last updated: May 17 '14