Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why there is a hardcoded maximum numbers of descriptors that can be matched with BFmatcher?

In BFMatcher::knnMatchImpl in matchers.cpp there is the following code:

https://github.com/Itseez/opencv/blob/master/modules/features2d/src/matchers.cpp#L728

const int IMGIDX_SHIFT = 18;
const int IMGIDX_ONE = (1 << IMGIDX_SHIFT);

https://github.com/Itseez/opencv/blob/master/modules/features2d/src/matchers.cpp#L825

CV_Assert( trainDescCollection[iIdx].rows < IMGIDX_ONE );

What is the point of this assertion that only makes sure that the number of training descriptors cannot be larger than precisely 262144, independently of the computer used?