<jupyter_start><jupyter_text>Template Matching  Import Libraries<jupyter_code>import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread("D:\Computer-Vision-Bootcamp\images\expert.png")

grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
template = cv2.imread("D:\Computer-Vision-Bootcamp\images\expert.png", 0)
w, h = template.shape[::-1]

#this function accept prameters (img,template,method)
res = cv2.matchTemplate(grey_img, template, cv2.TM_CCORR_NORMED)
print("res==",res)
threshold = 0.99
loc = np.where(res >= threshold)  #find brightest point
print("bright pixels==",loc)
count = 0
for i in zip(*loc[::-1]):
    print("i===",i)
    cv2.rectangle(img, i, (i[0] + w, i[1] + h), (0, 0, 255), 2)
    count+=1
print("number of iterations==",count)
img = cv2.resize(img,(800,600))
res = cv2.resize(res,(800,600))
cv2.imshow("img", img)
cv2.imshow("match temp==",res)
cv2.waitKey(0)
cv2.destroyAllWindows()<jupyter_output>res== [[0.9999981]]
bright pixels== (array([0], dtype=int64), array([0], dtype=int64))
i=== (0, 0)
number of iterations== 1
{'fraction_non_alphanumeric': 0.18779342723004694, 'fraction_numerical': 0.05727699530516432, 'mean_word_length': 6.1066666666666665, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '353501', 'license': 'MIT', 'n_tokens_mistral': 459, 'n_tokens_neox': 423, 'n_words': 89, 'path': 'Ex-27-Template Matching.ipynb', 'repo_name': 'imsanjoykb/Computer-Vision-Bootcamp', 'size': '1065'}