cv2.line() function is used to draw a line segment between start point and end point.
Create a function draw_line() to wrap the cv2.line() function, and set default values for color, thickness and line_type, when this function is invoked later don’t have to specify these parameters because these default values will be used.
1 def draw_line(image, start, end,
2 color=(255,255,255),
3 thickness=1,
4 line_type=cv2.LINE_AA):
5 cv2.line(image, start, end, color, thickness, line_type)
Call this function to draw a line,
7 # Draw a line
8 draw_line(canvas,
9 start=(100, 100),
10 end=(canvas.shape[1]-100, canvas.shape[0]-100),
11 color=(10, 10, 10),
12 thickness=10)
The result looks like Figure shown below-
0 comments:
Post a Comment