In this program, we will write text on an image using the opencv function putText(). This function takes in the image, font, coordinates of where to put the text, color, thickness, etc.
Original Image
Algorithm
Step 1: Import cv2 Step 2: Define the parameters for the puttext( ) function. Step 3: Pass the parameters in to the puttext() function. Step 4: Display the image.
Example Code
import cv2 image = cv2.imread("testimage.jpg") text = "TutorialsPoint" coordinates = (100,100) font = cv2.FONT_HERSHEY_SIMPLEX fontScale = 1 color = (255,0,255) thickness = 2 image = cv2.putText(image, text, coordinates, font, fontScale, color, thickness, cv2.LINE_AA) cv2.imshow("Text", image)