aircv 工具使用

"""
sudo pip3 install opencv-python
sudo pip3 install -i http://gfx-assets.fm.intel.com/artifactory/api/pypi/pypi-gsae/simple --trusted-host gfx-assets.fm.intel.com pbr
sudo pip3 install -i http://gfx-assets.fm.intel.com/artifactory/api/pypi/pypi-gsae/simple --trusted-host gfx-assets.fm.intel.com aircv
"""

import cv2
import aircv as ac

"""
主要有
cv2.line()// 画线,
cv2.circle() // 画圆
cv2.rectangle()// 长方形
cv2.ellipse() // 椭圆
cv2.putText() // 文字绘制

主要参数
img:源图像
color:需要传入的颜色
thickness: 线条的粗细,默认值是1
linetype:线条的类型,8连接,抗锯齿等。默认情况是8连接。
cv2.LINE_AA为抗锯齿,这样看起来会非常平滑
原文链接:
https://blog.csdn.net/weixin_41115751/article/details/84137783
"""

def 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()


import platform
print(platform.uname())

if __name__=="__main__":
png_path=r'/img/start.png'
aid_path='./img/start1.png'
imsrc=ac.imread(png_path)
imobj=ac.imread(aid_path)

pos=ac.find_template(imsrc,imobj)
circle_center_pos = tuple(list(map(int,list(pos['result']))))
print("圆心位置",circle_center_pos)
circle_radius=50
color = (255,0,0)
line_width = 2
draw_circle(imsrc,circle_center_pos,circle_radius,color,line_width)

原文地址:https://www.cnblogs.com/llx--20190411/p/15338540.html