Friday, December 31, 2010

Chamfer Matching

My understanding of Chamfer Matching is that it detects a particular object from an image by scanning the image for the edge pixels. In the default example, the cluttered logo image is distance-transformed. And the logo image, which is reduced to edges, is then being looked up from the cluttered one. The look-up method would produce a list of candidates ordered by a score. Put it simply, the score is determined by placing the logo on the distance transformed image, the score is equal to sum of each pixel value of the edge times the corresponding distance-value by placing the logo on various locations. This implementation also scan multiple passes of a set of user-specified scaling.

Performance: registering logo.png with logo_in_clutter.png. takes 1-2 minutes with default parameters. The cluttered logo image 600x824 in size. The logo image is 252x257 in size.

Parameters:

  • Increasing the minMatchDistance parameter to reduce matching the same object more than once. More matches would return as a result. The parameter value seems to be a Manhattan distance.
  • Increasing the maxMatches from default would also help discover intended matches if it is rotated.
  • Use the trio [ scales, minScale, maxScale ]  to improve matching due to size variants.
  • pad_X and pad_Y are x-steps and y-steps in Sliding Window Iterator, which is being used by the current implementation.
  • templScale parameter is simply set to label the current scale-factor of the supplied 'logo' is, should leave it as 1.


Observations:

  • Noise edges at the top half of the cluttered image often achieve 'high scores' with the 'logo', making other candidate matches essential to be looked at.
  • The results and costs vector are sorted in ascending order of costs.


Good introduction:

1 comment:

  1. Thank you so much for the explanation, can you help me though with these two questions?
    1- If there is no error, why it returns -1? shouldn't it return a result even if it was with very high cost?
    2- is the truncate parameter represent the number of missing pixels? or a percentage?
    Thank you in advance

    ReplyDelete