Skip to content

Files

Latest commit

 

History

History

Template Matching

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Template Matching in OpenCV

  • Template Matching is a method for searching and finding the location of a template image in a larger image.
  • It is one of the simplest forms of object detection, where a template is basically slided over the reference image to find if there is a match.
  • OpenCV provides a function to find matches, known as
    cv2.matchTemplate()

Reference image

Image

Template image

Image

Comaparison of different template matching methods

  • OpenCV offers various types of methods that aid in template matching, their working can be observed as follows
Method Template Matching
cv2.TM_CCOEFF Image
cv2.TM_CCOEFF_NORMED Image
cv2.TM_CCORR Image
cv2.TM_CCORR_NORMED Image
cv2.TM_SQDIFF Image
cv2.TM_SQDIFF_NORMED Image
  • Among the above mentioned methods, we can clearly say that cv2.TM_CCORR doesn't provide an accurate match

Author

Rohini Rao