Installing —
Pillow (a newer version of PIL)
PyTesseract
Apart from this, a tesseract executable needs to be installed.
Code implementation
The following functions were mainly used in the code & # 8212 ;
pytesseract.image_to_string (image, lang = ** language **) - Takes the image and searches for words of the language in their text.
cv2.cvtColor (image, ** color conversion **) - Used to make the image monochrome (using cv2.COLOR_BGR2GRAY).
ImageGrab. grab (bbox = ** Coordinates of the area of the screen to be captured **) - Used to repeatedly (using a loop) capture a specific part of the screen.
Objectives of the Code:
- Use a loop to capture multiple times part of the screen.
- To convert the captured image to grayscale.
- Use PyTesseract to read the text in it.
Code: Python code for using ImageGrab and PyTesseract
|
Exit
The above code can be used to grab a specific section screen and read its text content.