cv2.line using error [resolved] error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'line' > Overload

cv2.line:
image = cv2.line(image, starting point coordinates, end point coordinates, color, thickness)

When using cv2.line, the following error is reported
insert image description here

error prompts that the parameter type with index 1 is wrong, ie (weight, right_y), (0, left_y)


By printing, it is found that the data types of weight, right_y, and left_y are float
insert image description here

After changing the data type to int, no error will be reported

img = cv2.line(image3,(int(weigh), int(right_y)), (0, int(left_y)), (0, 255, 0), 2)

Guess you like

Origin blog.csdn.net/m0_50609545/article/details/129306877