BFMatcher with Hamming distace stores distances as integers instead of floats (Patch #2245)
Description
When BFMatcher is used with Hamming distance, BFMatcher::radiusMatchImpl() first calculates the result as integer to Mat dist. Then they are converted into float values and stored in Mat distf.
However, at http://code.opencv.org/projects/opencv/repository/revisions/master/entry/modules/features2d/src/matchers.cpp#L429 original dist matrix is still used to fetch the values instead of correct distf matrix. Integer values are just reiterpreted to be floats: const float* distptr = dist.ptr<float>(qIdx);
For loop at line http://code.opencv.org/projects/opencv/repository/revisions/master/entry/modules/features2d/src/matchers.cpp#L432 should probably be updated to use distf for consistency as well as it uses original dist matrix: for( int k = 0; k < dist.cols; k++ )
Current bug breaks radius searches and visualizations of matches point sets when Hamming distance is used.
Related issues
duplicated by Bug #2285: Descriptor matching with HAMMING distance | Cancelled | 2012-08-20 |
Associated revisions
#2245 Fix BFMatcher::radiusMatchImpl witch Hamming distance (thanks to Jukka Holappa)
Merge pull request #2245 from ilya-lavrenov:redundant_sync
History
Updated by Jukka Holappa over 12 years ago
Proposed patch to fix hamming distance radius search.
- File hamming-fix.diff added
Updated by Andrey Kamaev over 12 years ago
Thanks, your patch is applied in 36fe62d7a5129525d49d7356f2d6e969e74dac51
- Status changed from Open to Done
- Target version set to 2.4.3
- Assignee changed from Maria Dimashova to Andrey Kamaev
Updated by Andrey Kamaev over 12 years ago
- Tracker changed from Bug to Patch