BFMatcher with Hamming distace stores distances as integers instead of floats (Patch #2245)


Added by Jukka Holappa over 12 years ago. Updated over 12 years ago.


Status:Done Start date:2012-08-06
Priority:Normal Due date:
Assignee:Andrey Kamaev % Done:

0%

Category:features2d
Target version:2.4.3
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

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.


hamming-fix.diff - Proposed patch (811 Bytes) Jukka Holappa, 2012-08-09 07:24 pm


Related issues

duplicated by Bug #2285: Descriptor matching with HAMMING distance Cancelled 2012-08-20

Associated revisions

Revision 36fe62d7
Added by Andrey Kamaev over 12 years ago

#2245 Fix BFMatcher::radiusMatchImpl witch Hamming distance (thanks to Jukka Holappa)

Revision b104b04d
Added by Andrey Pavlenko about 11 years ago

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.

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

Also available in: Atom PDF