简体   繁体   中英

How can I match a template with the original image by SURF?

Recently, I have worked with robotics project; my robot can detect the object by its colour 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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM