You're here: Home / OpenCV /

Template Matching with OpenCV

Template matching is a technique for finding small parts of an image which match a template image. It slids the template from the top left to the bottom right of the image, and compare for the best match with template. The template dimension should be equal or smaller than the reference image.

Template matching is used in various applications. Some are:

  • Face Recognition.
  • Object Tracking.
  • Medical Image Processing.
  • etc.

OpenCV has functions to perform template matching with several methods. I have made an example on how to perform template matching with OpenCV. Download it by clicking the download link above. The program loads a reference image and a template, find subimage in reference image that match the template, then display both images.

Send suggestion, comments and bug reports to me [at] nashruddin.com

Keywords: template matching, object tracking, template, reference, opencv

Share:  del.icio.us logo Save to del.icio.us  digg logo Digg this!

comment.gifAdd your comment

(required, will not be published) (optional)