tests.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pytomatic 作者: N0K0 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号