PutText (img, string, starting point, font, font size,...)
Img: specify which image to draw on
String: the string we want to output
Starting point: the specific starting point of the string
import cv2 import numpy as np # 绘制一个黑色背景图 img=np.zeros((480,640,3),np.uint8) # 绘制文本 cv2.putText(img,'hello world',(100,100),cv2.FONT_HERSHEY_PLAIN,5,(255,0,0)) # 显示 cv2.imshow('img',img) cv2.waitKey(0)