Hello fellow learner! In this tutorial, we will learn how to write string text on Images in Python using the OpenCV putText() method. So let’s get started.
Table of Contents
What is the OpenCV putText() method?
OpenCV Python is a library of programming functions mainly aimed at real-time computer vision and image processing problems.
putText() method which is used to put text on any image. The method uses following parameters.
- img: The Image on which you want to write the text.
- text: The text you want to write on the image.
- org: It is the coordinates of the Bottom-Left corner of your text. It is represented as a tuple of 2 values (X, Y). X represents the distance from the left edge and Y represents the distance from the top edge of the image.
- fontFace: It denotes the type of font you want to use. OpenCV supports only a subset of Hershey Fonts.
- fontScale: It is used to increase/decrease the size of your text. The font scale factor is multiplied by the font-specific base size.
- color: It represents the color of the text that you want to give. It takes the value in
BGR format, i.e., first blue color value, then green color value, and the red color value all in range 0 to 255.
- thickness (Optional): It represents the thickness of the lines used to draw a text. The default value is 1.
- lineType (Optional): It denotes the type of line you want to use. 4 LineTypes available are
- LINE_8 (Default)
- bottomLeftOrigin (Optional): When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner. The default value is False.
#python modules #opencv #opencv puttext() #writing text on images #opencv puttext() - writing text on images #puttext() - writing text