Class TemplateMatching<T extends ImageBase<T>>

java.lang.Object
boofcv.alg.template.TemplateMatching<T>

public class TemplateMatching<T extends ImageBase<T>> extends Object
Runs a template matching algorithm across the image. Local peaks are found in the resulting intensity image and the best solutions returned.
  • Constructor Details

    • TemplateMatching

      public TemplateMatching(TemplateMatchingIntensity<T> match)
      Specifies internal algorithm
      Parameters:
      match - Provide template matching intensity algorithm
  • Method Details

    • setMinimumSeparation

      public void setMinimumSeparation(int radius)
      Adjust how close to objects can be found to each other
      Parameters:
      radius - Distance in pixels. Try using the template's radius or 2
    • setTemplate

      public void setTemplate(T template, T mask, int maxMatches)
      Specifies the template to search for and the maximum number of matches to return.
      Parameters:
      template - Template being searched for
      mask - Optional mask. Same size as template. 0 = pixel is transparent, values larger than zero determine how influential the pixel is. Can be null.
      maxMatches - The maximum number of matches it will return
    • setImage

      public void setImage(T image)
      Specifies the input image which the template is to be found inside.
      Parameters:
      image - Image being processed
    • process

      public void process()
      Performs template matching.
    • getResults

      public DogArray<Match> getResults()
      Returns all the found matches. The location is the location of the top left corner of the template. Score is the first score with higher number being better
      Returns:
      List of found templates