关于opencv图片坐标系的理解

坐标体系中的零点坐标为图片的左上角,X轴为图像矩形的上面那条水平线;Y轴为图像矩形左边的那条垂直线。X,Y均为正数,该坐标体系在诸如结构体Mat,Rect,Point中都是适用的。

img = np.zeros((500, 500, 3), dtype=np.uint8)
img[:, :, :] = 255
cv2.rectangle(img, (100, 100), (400, 400), [0, 0, 255])
cv2.rectangle(img, (200, 200), (300, 300), [0, 0, 255])
cv2.imshow("img", img)
cv2.waitKey(-1)

绘制图片

猜你喜欢

转载自www.cnblogs.com/answerThe/p/11428284.html