I am trying to use FLANN with ORB descriptors, but opencv crashes with this simple code:
vector<vector<KeyPoint> > dbKeypoints;
vector<Mat> dbDescriptors;
vector<Mat> 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
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 ;-)