Class ChamferMatcher

java.lang.Object
imagingbook.common.image.matching.ChamferMatcher

public class ChamferMatcher extends Object

Instances of this class perform "chamfer" matching on binary images. The "search" image I (to be searched for matches of the "reference" image R) is linked to this ChamferMatcher instance. The associated distance transformation of the search image I is pre-calculated during construction. The assumption is, that the search image I is fixed and the ChamferMatcher tries to match multiple reference images R. All images are considered binary, with non-zero values taken as foreground pixels. See Sec. 23.2.3 (Alg. 23.3) of [1] for additional details.

[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

Version:
2022/12/14
  • Constructor Details

    • ChamferMatcher

      Constructor using the default distance norm (L2). The supplied image must be binary with zero background values.
      Parameters:
      I - the binary "search" image (to be searched for matches of the "reference" image)
    • ChamferMatcher

      Constructor using the specified distance norm. The supplied image must be binary with zero background values.
      Parameters:
      I - the binary "search" image (to be searched for matches of the "reference" image)
      norm - the distance norm
  • Method Details

    • getMatch

      public float[][] getMatch(ByteProcessor R)
      Calculates the match function for specified reference image R to this matcher's search image I (defined by the constructor). The returned function Q[r][s] is the match score for reference image R positioned at (r,s) in the search image coordinate frame.
      Parameters:
      R - a binary reference image
      Returns:
      a 2D array Q[r][s] of match scores
    • getMatch

      public float[][] getMatch(Pnt2d.PntInt[] pR, int wR, int hR)
      Matches the specified point set to the (fixed) search image I. The points represent the foreground pixels of a virtual reference image (R) with the specified width and height.
      Parameters:
      pR - a set of foreground points representing the reference image R
      wR - the width of the reference image
      hR - the height of the reference image
      Returns:
      a 2D array Q[r][s] of match scores