python在图片上画矩形
image_path = ''
image = cv2.imread(image_path)
first_point = (100, 100)
last_point = (100, 100)
cv2.rectangle(image, first_point, last_point, (0, 255, 0), 2)
cv2.imwrite(image_path, image)
first_point和last_point都是矩形在图片的像素坐标位置,且坐标位置为int整型。
first_point为矩形左上角的坐标位置
last_point为矩形右下角的坐标位置
该两点的存在刚好能够组成一个矩形
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)