In this Project, we will see how to use OpenCV cv2.putText() function for writing a text on the image in Python.
In this project, we will see how to write text on the image. Firstly, import libraries and read the image then initialize the counter that will be used for changing the position of the text. Inside an infinite while loop, Display the image and use cv2.waitKey()
for a keypress. Specify the font and draw the text using cv2.putText()
cv2.putText(img, position, font, fontScale, color, thickness, lineType, bottomLeftOrigin)
Next, increase the counter and provide the termination condition where key ‘q’ breaks the loop. Lastly, we call cv2.destroyAllWindows() function for destroys all the windows we created.
Submitted by SATYAM PRADIP GADEKAR (satyamgadekar77)
Download packets of source code on Coders Packet
Comments