opencv FLANN with ORB descriptors?

匿名 (未验证) 提交于 2019-12-03 00:52:01

问题:

I am trying to use FLANN with ORB descriptors, but opencv crashes with this simple code:

vector > dbKeypoints; vector dbDescriptors; vector objects;     /*   load Descriptors from images (with OrbDescriptorExtractor()) */  FlannBasedMatcher matcher;  matcher.add(dbDescriptors);  matcher.train() //> Crash! 

If I use SurfDescriptorExtractor() it works well.

How can I solve this?

OpenCV says:

OpenCV Error: Unsupported format or combination of formats (type=0 ) in unknown function, file D:\Value\Personal\Parthenope\OpenCV\modules\flann\sr c\miniflann.cpp, line 299 

回答1:

Flann needs the descriptors to be of type CV_32F so you need to convert them! find_object/example/main.cpp:

if(dbDescriptors.type()!=CV_32F) {     dbDescriptors.convertTo(dbDescriptors, CV_32F); } 

may work ;-)



回答2:

It's a bug. It will be fixed soon.

http://answers.opencv.org/question/503/how-to-use-the-lshindexparams/



回答3:

When using ORB you should construct your matcher like so:

FlannBasedMatcher matcher(new cv::flann::LshIndexParams(5, 24, 2)); 

I've also seen this constructor suggested:

FlannBasedMatcher matcher(new flann::LshIndexParams(20,10,2)); 


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