角点
P1 (255, 000, 000)
P2 (000, 255, 000)
P3 (000, 000, 255)
P4 (000, 000, 000)
垂直矩形框
rect = cv2.minAreaRect(cnt)targetColor = roi_colortargetThickness = 1targetColor = (255, 255, 255)if lineVerbose:if True:cv2.line(photo, (x, y), (x+w//4, y), targetColor, targetThickness)cv2.line(photo, (x, y), (x, y+h//4), targetColor, targetThickness)cv2.line(photo, (x+3*w//4, y), (x+w, y), targetColor, targetThickness)cv2.line(photo, (x+w, y), (x+w, y+h//4), targetColor, targetThickness)cv2.line(photo, (x, y+h), (x+w//4, y+h), targetColor, targetThickness)cv2.line(photo, (x, y+h), (x, y+3*h//4), targetColor, targetThickness)cv2.line(photo, (x+w, y+h), (x+3*w//4, y+h), targetColor, targetThickness)cv2.line(photo, (x+w, y+h), (x+w, y+3*h//4), targetColor, targetThickness)crossLength = 15cv2.line(photo, (x+w//2-crossLength, y+h//2), (x+w//2+crossLength, y+h//2), targetColor, targetThickness)cv2.line(photo, (x+w//2, y+h//2-crossLength), (x+w//2, y+h//2+crossLength), targetColor, targetThickness)
倾斜矩形框