16.Line segment drawing

When using OpenCV to process images, we sometimes need to draw line segments, rectangles, etc. on the image. OpenCV uses the line(dst, pt1, pt2, color, thickness=None, lineType=None, shift=None) function to draw line segments.

Parameter Description:

dst: output image.

pt1, pt2: required parameters. The coordinate points of the line segment represent the starting point and the ending point respectively.

color: required parameter. Used to set the color of line segments

thickness: optional parameter. Used to set the width of the line segment

lineType: optional parameter. Used to set the type of line segment, optional 8 (8 adjacent connecting lines - default), 4 (4 adjacent connecting lines) and cv2.LINE_AA is anti-aliasing

Code path:muto/Samples/OpenCV/03_Image processing and text drawing/04 Line segment drawing.ipynb