[英]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 在您的OpenCV目录的示例目录中,有一个很好的示例可以了解如何使用SURF:OpenCV / samples / c / find_obj.cpp
You need to use the SURF descriptors (see lines 245-255) 您需要使用SURF描述符(请参见第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读取描述符:
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. 对场景做同样的事情,并在NN搜索中使用两个描述符来找到它们之间的匹配。 One again, the sample given by OpenCV should help you a lot :) 再一次,OpenCV提供的示例应该对您有很大帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.