savvytaya.blogg.se

Opencv write text on image
Opencv write text on image













opencv write text on image

Then we are reading the image on which the text is supposed to be written using the imread() function from the cv2 module. In the above program, we are importing the module cv2. Imagewrite = cv2.imread('C:/Users/admin/Desktop/tree.jpg', cv2.IMREAD_UNCHANGED) The output is shown in the snapshot above. Then we are displaying the resulting image with text written on it as the output on the screen. Then we are using the putText() function to write the text on the image by specifying all the parameters. Then we are storing the position of the text on the image along the horizontal and vertical axes in a variable. Imagewrite = cv2.imread('C:/Users/admin/Desktop/plane.jpg', cv2.IMREAD_UNCHANGED) #displaying the resulting image as the output on the screenĬv2.imwrite("C:/Users/admin/Desktop/logo1.png", imagewrite) #specifying the thickness of the font line in the text #specifying the position of the text on the image #specifying the text to be written on the image #specifying the image on which text must be written #using putText() function to write the text on the image #storing the position of the text on the image along the horizontal and vertical axes in a variable Imagewrite = cv2.imread('C:/Users/admin/Desktop/logo.png', cv2.IMREAD_UNCHANGED) #reading the image on which the text is to be written using imread() function OpenCV program in python to demonstrate putText() function using which we are going to write a text on the image and display the image with text written on it as the output on the screen: Here are the following examples mention below Example #1 The putText() function returns an image with text written on it.Some of the font types of the text to be written on the image are FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, etc.

opencv write text on image

The putText() function in OpenCV is very much essential in solving computer vision problems.Whenever there is a necessity to write text on an image, we make use of a function called the putText() function in OpenCV.Thickness is the thickness of the font line in the text. Position is the position of the text on the image along the horizontal and vertical axes, Text is the text that is supposed to be written on the image, Where image is the image on which the text is supposed to be written, Web development, programming languages, Software testing & othersĬv2.putText(image, text, position, textfont, fontsize, fontcolor, thickness) Start Your Free Software Development Course















Opencv write text on image