Learn Before
Concept

Line Method

Remember that the pixel information is stored inside of an array. Therefore, there is a similar coordinate system that maps the screen or an image. The top left will be (0,0). The cv2.line() method requires the image object, two coordinate values, color and pixel thickness.

img = cv2.line(frame, (0,0), (width, height), (255, 0,0), 10) cv2.imshow('frame', img)

To draw multiple lines, we need to draw the new line on the modified img object.

img = cv2.line(frame, (0,0), (width, height), (255, 0,0), 10) img = cv2.line(img, (0,height), (width, 0), (0, 255,0), 5) cv2.imshow('frame', img)

0

1

Updated 2021-06-26

Tags

Python Programming Language

Data Science

Related