# 报错原因一, 不是整数,加int(),强制为整数
cv2.rectangle(img, (int(x1),int(y1)), (int(x2),int(y2)), (0,0,255), 3)
# 报错原因二, numpy数组在存储的过程中不连续了,一行api让他连起来
img = np.ascontiguousarray(img) # img为你的图片数组
cv2.rectangle 报错(error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function ‘rectangle‘)
最新推荐文章于 2023-12-26 11:04:07 发布