5.3. Template matching

5.3.1. Definition

Template matching is conceptually a simple process. We need to match a template to an image, where the template is a subimage that contains the shape we are trying to find. Accordingly, we centre the template on an image point and count how many points in the template matched those in the image. The procedure is repeated for the entire image and the point which led to the best match, the maximum count, is deemed to be the point where the shape (given by the template) lies within the image.
Consider that we want to find the template of Fig. 5.3B in the image of Fig. 5.3A. The template is first positioned at the origin and then matched with the image to give a count that reflects how well the template ...

Get Feature Extraction and Image Processing for Computer Vision, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.