# cv2.circle(img, center, radius, color, thickness, lineType, shift) # ————Parameter Description———— # img:Specify canvas # center: (x, y) # radius # color: (B,G,R) # thinkness: Line width, When >0, it represents the thickness of the circular border (in pixels), when <0, it represents a solid circle. # lineType # shift:Accuracy of circle center coordinates and radius
# cv2.ellipse(img, center, axes, angle, startAngle, endAngle, color, thickness, lineType, shift) # ————Parameter Description———— # img: Specify canvas # center: (x, y), Ellipse center point coordinates # axes: Ellipse size (major and minor axis) # angle: Rotation angle (clockwise) # startAngle: The starting angle for drawing (clockwise) # endAngle: The ending angle of the drawing (drawing the entire ellipse: [0,360]; drawing the lower half of the ellipse: [0,180]) # color: (B,G,R) # thickness: Line width # lineType: default=8 # shift: Accuracy of center coordinates and axis length (default=0)
# cv2.rectangle(img, pt1, pt2, color, thickness=None, lineType, shift) # ————Parameter Description———— # img: Specify canvas # pt1: (x, y),Point coordinates of the upper left corner of the rectangle # pt2: (x, y),Point coordinates of the lower right corner of the rectangle # color: (B,G,R) # thinkness: Line width, When >0, it represents the thickness of the rectangular border (in pixels), when <0, it represents a solid rectangle. # lineType # shift: Point coordinate accuracy
# cv2.polylines(img, pts, isClosed, color, thickness, lineType, shift) # ————Parameter Description———— # img: Specify canvas # pts: (x, y),point set # isClosed: Whether the multiple line segments drawn are closed. True means closed and will connect the first and last points. # color: (B,G,R) # thickness: Line width # lineType: default=8 # shift: Point coordinate accuracy
# cv2.putText(img, text, org, fontFace, fontScale, color, thickness, lineType, bottomLeftOrigin) # ————Parameter Description———— # img: Specify canvas # text: Text content # org: The drawing position, which is the coordinate of the lower left corner of the text string # fontFace: Font type # fontScale: Font size # color # thickness # lineType: Boundary type # bottomLeftOrigin: true/false. If true, the origin is in the lower left corner of the text image, otherwise it is in the upper left corner; if set to true, the text will be upside down, and the default is false.
Usually you need to use waitKey() after imshow(). waitKey(0) means waiting until any key is pressed, and waitKey(n) means delaying n milliseconds to close the window.