def test_templating(self):
bbox = self.wh.create_boundingbox()
scaled_bbox = self.wh.bbox_scale(bbox,0.5)
sub_image = self.px.grab_window(scaled_bbox)
sub_image = self.px.img_to_numpy(sub_image)
w, h = sub_image.shape[0:2]
main_image = cv2.imread('pytomatic/tests/assets/calc_clean.PNG')
res = cv2.matchTemplate(main_image, sub_image, cv2.TM_CCOEFF)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
top_left = max_loc
bottom_right = (top_left[0] + w, top_left[1] + h)
cv2.rectangle(main_image, top_left, bottom_right, 255, 2)
assert top_left == (89,89)
assert bottom_right == (290,290)
#plt.imshow(main_image)
#plt.show()
评论列表
文章目录