Pythonilla tolppaan - osa 3

 perjantai, 25. marraskuu 2016
Pythonilla tolppaan - osa 3

import cv2
import numpy as np

img_rgb = cv2.imread('kt61.jpg')
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)

temp = cv2.imread('match.jpg',0)
w, h = temp.shape[::-1]

res = cv2.matchTemplate(img_gray,temp,cv2.TM_CCOEFF_NORMED)
thresh = 0.6
loc = np.where( res >= thresh)

for pt in zip(*loc[::-1]):
    cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (255,0,0), 1)

cv2.imshow('Img',img_rgb)
cv2.waitKey(0)
cv2.destroyAllWindows()



Comments

Popular posts from this blog

Modifying old SDR# TETRA demod plug-in

Mods for SDR# TETRA demod plugin 1.0.14.0 - 2