In this tutorial, we will introduce how to use cv2.putText() method to draw text on an image in python opencv.
1.Read an image
import cv2 img = cv2.imread('C:/Users/N/Desktop/monument.png')
2.Draw Text on an image
cv2.putText(img, "My text", (0, 30), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 0, 0), 4)
Here (0, 30) is the position of text in image.
3.Show image with text
cv2.imshow('image', img) cv2.waitKey(0) cv2.destroyAllWindows()