1)下载安装opencv-2.4.9,并将cv2.pyd拷贝到python安装目录的site-package下2)pip install numpy3)pip install aircv
import cv2import aircv as ac# print circle_center_posdef draw_circle(img, pos, circle_radius, color, line_width): cv2.circle(img, pos, circle_radius, color, line_width) cv2.imshow('objDetect', imsrc) cv2.waitKey(0) cv2.destroyAllWindows()if __name__ == "__main__": imsrc = ac.imread('bg.jpg') imobj = ac.imread('obj.png') # find the match position pos = ac.find_template(imsrc, imobj) circle_center_pos = pos['result'] circle_radius = 50 color = (0, 255, 0) line_width = 10 # draw circle draw_circle(imsrc, circle_center_pos, circle_radius, color, line_width)
联系客服