Ask Your Question
0

C++ ORB Feature Matching with FLANN Lsh Error

asked 2019-08-15 08:38:17 -0600

davor gravatar image

updated 2019-08-15 09:03:16 -0600

I am trying to match Orb features using FLANN matcher and LSH, and it gives me this error:

OpenCV: terminate handler is called! The last OpenCV error is:

OpenCV(4.1.0) Error: Unsupported format or combination of formats (> type=5 > ) in buildIndex_, file C:\opencv\source\opencv-4.1.0\modules\flann\src\miniflann.cpp, line 315

What is the reason for this?

Descriptors are already converted to CV_32F.

cv::FlannBasedMatcher matcher = cv::FlannBasedMatcher(cv::makePtr<cv::flann::LshIndexParams>(12, 20, 2));
std::vector< std::vector<cv::DMatch> > matches;
matcher.knnMatch(descriptors1, descriptors2, matches, 2 );
edit retag flag offensive close merge delete

Comments

cv::FlannBasedMatcher matcher = cv::FlannBasedMatcher(cv::makePtr(12, 20, 2));

template args for makePtr are missing, can you take a look ?

berak gravatar imageberak ( 2019-08-15 09:00:35 -0600 )edit
1

I accidentally deleted them when I copied the code. Now I added that here.

davor gravatar imagedavor ( 2019-08-15 09:02:30 -0600 )edit

Descriptors are already converted to CV_32F.

that looks wrong

berak gravatar imageberak ( 2019-08-15 09:08:46 -0600 )edit

When I delete that conversion, it works. But then it returns this: Process returned -1073741819 (0xC0000005)

at the ratio test.

const float ratio_thresh = 0.7f;
for (size_t i = 0; i < matches.size(); i++){
    if (matches[i][0].distance < ratio_thresh * matches[i][1].distance){
        good.push_back(matches[i][0]);
    }
}
davor gravatar imagedavor ( 2019-08-15 09:12:40 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2019-08-15 12:10:11 -0600

davor gravatar image

The problem was solved. The problem was that descriptors should not be converted to CV_32F and that I need to check if (matches[i].size() >= 2) Thanks!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-08-15 08:38:17 -0600

Seen: 1,485 times

Last updated: Aug 15 '19