运行环境 python2
1.安装:https://blog.csdn.net/liuweiyuxiang/article/details/80591640
2.图像上加方框及文字:
* https://blog.csdn.net/xieqiaokang/article/details/60780608
* https://jingyan.baidu.com/article/d5a880ebdd962f13f147ccb9.html
重点命令:
* 1.cv2.imread 读取图像
img = cv2.imread(filename)
* 2.cv2.rectanle 加方框
cv2.rectangle(img,(int(sx1),int(sy1)),(int(sx2),int(sy2)),(0,255,0),3)
# 输入参数分别为图像、左上角坐标、右下角坐标、颜色数组、粗细
cv2.rectangle(img, (x,y), (x+w,y+h), (B,G,R), Thickness)
* 3.cv2.putText 加文字
cv2.putText(img, text, (int(sx1),int(sy1-6)), cv2.FONT_HERSHEY_COMPLEX_SMALL,0.8, (0, 255, 0) )
# 输入参数为图像、文本、位置、字体、大小、颜色数组、粗细
cv2.putText(img, text, (x,y), Font, Size, (B,G,R), Thickness)
* 4.cv2.write 保存处理后的图像
cv2.imwrite('001_new.jpg', img)
* 5.cv2.imshow 显示处理后的图像
cv2.imshow('001_new.jpg', img)
cv2.waitKey (0)
cv2.destroyAllWindows()
待完善...