Line (img, start point, end point, color...)
Img: specify which picture to draw on
Start point, end point: specify the start and end position of the line
Color, Lineweight, Linetype
Shift: coordinate scaling
import cv2 import numpy as np # 绘制一个黑色背景图 img=np.zeros((480,640,3),np.uint8) # 画直线 cv2.line(img,(10,20),(300,400),(0,0,255),5) # 显示 cv2.imshow('img',img) cv2.waitKey(0)