ORB compute bug: it removes all keypoints with a small image

对着背影说爱祢 提交于 2019-12-11 02:13:31

问题


I have a small image 50x50. I find ORB keypoints with:

(Notice that I have to change the default param of patchSize from 31 to 14 to get some keypoints detected):

 OrbFeatureDetector det(500,1.2f,8,14,0,2,0,14);   //> (From 31 to 14)
 OrbDescriptorExtractor desc;

 det.detect(image,kp)
 //> kp.size() is about 50 keypoints

Now If i pass my keypoints to orb.compute I get all keypoints erased.

 desc.compute(image,kp,kpDesc);
 //> Now kp.size() == 0

This mean that after I have called .compute the method has deleted all keypoints.

The Image I am using is this:

I believe this is some sort of bug. Someone can confirm? I am using OpenCV 2.4.5


回答1:


No it is not a bug.

The problem is that OrbDescriptorExtractor doesn't know that you have changed the param in the FeatureDetector. So you have to set the right params again:

OrbFeatureDetector      det(500,1.2f,8,14,0,2,0,14);   //> (From 31 to 14)
OrbDescriptorExtractor desc(500,1.2f,8,14,0,2,0,14); 



回答2:


You are creating two objects, a feature detector and a descriptor extractor. These must be initialized with the same parameters.

You can reduce the code duplication in having to set identical parameters twice by creating a single instance of cv::ORB and then calling cv::ORB::operator(), like so:

cv::ORB orb(500,1.2f,8,14,0,2,0,14);
orb(image,cv::noArray(),kp,kpDesc);

This will be identical to your initial solution, since the feature detector and extractor are really the same object. From the OpenCV headers:

typedef ORB OrbFeatureDetector;
typedef ORB OrbDescriptorExtractor;


来源:https://stackoverflow.com/questions/16688909/orb-compute-bug-it-removes-all-keypoints-with-a-small-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!