Recently, I have worked with robotics project; my robot can detect the object by its 开发者_如何学Ccolour but I found that not good enough for different object. Therefore, I want the robot SURF the image on real time to find the target object that will be defined using its template.
Unfortunately, I don’t know how to match the key points of the template with its image in the image.
There is a very good example to know how to use SURF in the sample directory in your OpenCV directory: OpenCV/samples/c/find_obj.cpp
You need to use the SURF descriptors (see lines 245-255)
CvSeq *objectKeypoints = 0, *objectDescriptors = 0;
CvSURFParams params = cvSURFParams(500, 1);
cvExtractSURF(object, 0, &objectKeypoints, &objectDescriptors, storage, params);
You should read the descriptors with a CvSeqReader:
CvSeqReader reader;
cvStartReadSeq(descriptors, &reader, 0);
Do the same thing with scene and use the two descriptors in NN search to find the match between them. One again, the sample given by OpenCV should help you a lot :)
精彩评论