Introduction of Template Matching in Image Processing

January 31, 2018 Author: virendra
Print Friendly, PDF & Email

Template matching is one of the areas of profound interests in recent times. It has turned out to be a revolution in the field of computer vision. Template Matching is a high-level machine vision technique that identifies the parts on an image that match a predefined template. Advanced template matching algorithms allow to find occurrences of the template regardless of their orientation and local brightness. Template Matching techniques are flexible and relatively straightforward to use, which makes them one of the most popular methods of object localization. Their applicability is limited mostly by the available computational power, as identification of big and complex templates can be time-consuming.

What is Template Matching?

Template matching is a technique used in classifying an object by comparing portions of images with another image. One of the important techniques in Digital image processing is template matching. Templates are usually employed to print characters, identify numbers, and other little, simple objects. It can be used for detection of edges in figures, in manufacturing as a part of quality control and a means to navigate a mobile robot.

Example of Template Matching

Figure 1: Example of Template Matching

Figure 1 depict the example of template matching. Template Matching is a strategy for discovering zones of an image which matches (are indistinguishable) a template image (patch). We require 2 crucial segments. We need two vital segments:

Source image (I): The picture inside which we are hoping to find out a match to the template image.

Template image (T): The patch image that can be compared to the template image and our objective is to discover the most effective technique for the best matching region. Matching technique not solely takes the similarity measure however it computes the inaccuracy among images reckoning on the difference by means of Mean Squared Error (MSE) metric.

Template Matching Image

Figure 2: Template Matching Image

Template Matching Approaches

General categorizations of template or image matching approaches are Featured-based approach and Template or Area based approach:

Featured-based approach: The Featured-based method is appropriate while both reference and template images have more connection with regards to features and control points. The features comprises of points, a surface model which needs to be matched, and curves. At this point, the goal is to position the pairwise association amongst reference and layout picture using their spatial relations or descriptors of components.

Template based approach: Template-based template matching approach could probably require sampling of a huge quantity of points, it is possible to cut back the amount of sampling points via diminishing the resolution of the search and template images via the same factor and performs operation on resulting downsized images (multiresolution, or Pyramid (image processing)) , providing a search window of data points inside the search image in order that the template doesn’t have to be compelled to look for each possible data point and the mixture of the two.

Area based approach: The Area-based methods are typically referred to as correlation like methods or template matching methods, that is the blend of feature matching, feature detection, motion tracking, occlusion handling etc. Area-based methods merge the matching part with the feature detection step. These techniques manage the pictures without attempting to identify the remarkable article. Windows of predefined size are used for the estimation of correspondence.

Motion Tracking and Occlusion Handling: For the templates which cannot provide and may not provide an instantaneous match, in that case Eigen spaces may be used , which provides the details of matching image beneath numerous conditions, appropriate matching poses or colour contrast. For instance, if the person turned into searching out a specimen, the Eigen spaces may include templates of specimen totally different in numerous positions to camera with different lighting conditions or expressions .There is feasibility for the matching figure to be occluded via an associated item or issues involved in movement turn out to be ambiguous. One amongst the probable answers for that can be to separate the template into more than one sub images and carry out matching on them.

Limitation of template matching

Following are the limitations of template matching:

  • Templates are not rotation or scale invariant.
  • Slight change in size or orientation variations can cause problems.
  • It often use several templates to represent one object.
  • Templates may be of different sizes.
  • Rotations of the same template.
  • Particularly if you search the entire image or if you use several templates in that case template matching is a very expensive operation.
  • Template matching is easily “parallelized”.
  • Template Matching requires high computational power because the detection of large patterns of an image is very time taking.


[1] Paridhi Swaroop and Neelam Sharma, “An Overview of Various Template Matching Methodologies in Image Processing”, International Journal of Computer Applications (IJCA), Volume 153 – No 10, November 2016

[2] T. Mahalakshmi, R. Muthaiah and P. Swaminathan, “Review Article: An Overview of Template Matching Technique in Image Processing”, Research Journal of Applied Sciences, Engineering and Technology, Volume 4, Number 24, pp. 5469-5473, 2012.

[3] Nazil Perveen, Darshan Kumar and Ishan Bhardwaj, “An Overview on Template Matching Methodologies and its Applications”, International Journal of Research in Computer and Communication Technology, Volume 2, Issue 10, October- 2013.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Insert math as
Additional settings
Formula color
Text color
Type math using LaTeX
Nothing to preview