Ask Your Question

Revision history [back]

Running into an error using cv::BFMatcher (bruteforce matcher) with 10,100 training images

I'm implementing a simple bag-of-words matching system, where I have 10,100 "clusters" and I am trying to match a single feature vector to the closest cluster. This works for a smaller number of clusters, but I need it to work for this larger set.

Essentially, I put all 10,100 clusters into a vector of cv::Mat objects, each of which is 1 x 16. Then, I add these to the BFMatcher as follows:

cv::BFMatcher matcher(cv::NORM_HAMMING);
bf_matcher.add(clusters_for_matching);

Finally, given a new 1 x 16 feature vector to match, I do the following:

std::vector<cv::DMatch> matches;
bf_matcher.match(feature_vector, matches);

The error I get is the following:

OpenCV Error: Assertion failed ((int64)imgCount*IMGIDX_ONE < INT_MAX) in unknown function, file ......\src\opencv\modules\features2d\src\matchers.cpp, line 360

My question is simple, what is going on and how can I make this work? It's pretty clear that for some reason it considers 10,100 to be too many training instances, but that is extremely small in comparison to some other applications.

Running into an error using cv::BFMatcher (bruteforce matcher) with 10,100 training images

I'm implementing a simple bag-of-words matching system, where I have 10,100 10,100 "clusters" and I am trying to match a single feature vector to the closest cluster. This works for a smaller number of clusters, but I need it to work for this larger set.

Essentially, I put all 10,100 10,100 clusters into a vector of cv::Mat objects, each of which is 1 x 16. Then, I add these to the BFMatcher as follows:

cv::BFMatcher matcher(cv::NORM_HAMMING);
bf_matcher.add(clusters_for_matching);

Finally, given a new 1 x 16 feature vector to match, I do the following:

std::vector<cv::DMatch> matches;
bf_matcher.match(feature_vector, matches);

The error I get is the following:

OpenCV Error: Assertion failed ((int64)imgCount*IMGIDX_ONE < INT_MAX) in unknown function, file ......\src\opencv\modules\features2d\src\matchers.cpp, line 360

My question is simple, what is going on and how can I make this work? It's pretty clear that for some reason it considers 10,100 10,100 to be too many training instances, but that is extremely small in comparison to some other applications.