我正在尝试在opencv中使用flann的LSH实现:
const int mySizes[1]={100};
cv::Mat descriptors1 = cv::Mat::zeros(1,mySizes,CV_32F);
cv::Mat descriptors2 = cv::Mat::zeros(1,mySizes,CV_32F);
cv::Ptr<cv::DescriptorMatcher> matcher_;
matcher_ = new cv::FlannBasedMatcher(new cv::flann::LshIndexParams(20,10,2));
std::vector<cv::DMatch> matches;
matcher_->match(descriptors1, descriptors2, matches);
std::cout << matches[0].distance << std::endl;
更准确地说,我想获得descriptors1
和descriptors2
使用之间的 LSH 距离matches[0].distance
。
但是当我运行这段代码时,我得到:
OpenCV Error: Unsupported format or combination of formats (type=5
) in buildIndex_, file /home/lpuglia/repository/opencv/modules/flann/src/miniflann.cpp, line 315
terminate called after throwing an instance of 'cv::Exception'
what(): /home/lpuglia/repository/opencv/modules/flann/src/miniflann.cpp:315: error: (-210) type=5
in function buildIndex_
代码很简单,我做错了什么?