Template matching is one of the areas of profound interest in recent times. It has turned out to be a revolution in 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 us 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 it?
It 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 simple objects. It can be used for the detection of edges in figures, in manufacturing as a part of quality control, and as a means to navigate a mobile robot.
Figure 1: Example of Template Matching
Figure 1 depicts an example of it. It is a strategy for discovering zones of an image, which match (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. The 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.
Figure 2 Real-world application
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 regard to features and control points. The features comprise 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 pictures 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 number of sampling points by diminishing the resolution of the search and template images via the same factor and performing an operation on the 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: Area-based methods are typically referred to as correlation-like methods or template-matching methods, which 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 is 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, Eigenspaces may be used, which provides the details of matching images beneath numerous conditions, appropriate matching poses, or color contrast. For instance, if the person turned into searching out a specimen, the Eigen spaces may include templates of specimens totally different in numerous positions to the 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 of the probable answers for that can be to separate the template into more than one sub-images and carry out matching on them.
The following are the limitations of template matching:
- Templates are not rotation or scale invariant.
- Slight changes in size or orientation variations can cause problems.
- It often uses 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.
- It is easily “parallelized”.
- It requires high computational power because the detection of large patterns of an image is very time taking.
 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
 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.
 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.