4. Line drawing

4.1.OpenCV line drawing

When using OpenCV to process images, we sometimes need to draw line segments, rectangles, etc. on the image. In OpenCV, use the

cv2.line(dst,pt1,pt2,color,thickness=None,lineType=None,shift=None)function to draw line segments.

Parameter meaning:

dst: output image.

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

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

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 for anti-aliasing

4.2. Actual effect display

Source code path:

/home/pi/project_demo/06.Open_source_cv_fundamentals_course/C.Image_Processing_Text_Drawing/04_Line_Drawing.ipynb