Concept: To write text on image with OpenCV library of Python, use putText() method. The usage of putText() function is provided in the following example.
As you can see from the above example, you can provide
image on which you can write the text.
text you want to write on image.
position: distance along horizontal and vertical axis from top left corner of the image.
font family
font size
font color
font stroke width
In the above example, we have provided a sample image, and wrote some text on the image. We have written the output image to a file. Following are the input and output images.
import numpy as np
import cv2# 事先安装pip install opencv
image = cv2.imread('C:/Users/Mr.R/Pictures/wallpaper/121.jpg',cv2.IMREAD_UNCHANGED)
position = (10,50)
cv2.putText(
image, #numpy array on which text is written</