Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Get the coordinates of a found object using a template.

$
0
0
So this is my code: import cv2 import numpy as np import pyautogui img_bgr = cv2.imread('gra.png') img_gray = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2GRAY) template = cv2.imread('bones2.png', 0) w, h = template.shape[:: -1] res = cv2.matchTemplate(img_gray, template, cv2.TM_CCOEFF_NORMED) threshhold = 0.90 loc = np.where( res >= threshhold) for pt in zip(*loc[:: -1]): cv2.rectangle(img_bgr, pt, (pt[0] + w, pt[1] + h),(0, 255, 255), 2 ) cv2.imshow('znalezione', img_bgr) pyautogui.moveTo( ? , ? ,duration=0.5) <======== problem my question is how can i get the coors of that object

Viewing all articles
Browse latest Browse all 41027

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>