Applying OCR on manually selected Region of Interests (using mouse drag) for Text extraction from Images
- Install pytesseract() and setting it to the path variable
- Tesseract Download Link: https://github.com/UB-Mannheim/tesseract/wiki
- Import the required libraries
- Read the image file into python using OpenCV’s imread() method
- Resize (if necessary) the images and converting them into grey scale using OpenCV’s resize () and cvtColor() methods respectively
- Extract the Region of Interest from the image manually using mouse drag.
- Starting coordinates are stored when the left mouse button is pressed and the ending coordinates when the left mouse button is released.
- Extract the region between these starting and ending coordinates when ‘enter’ is pressed. If ‘c’ is pressed the coordinates are cleared.
- Optical Character Recognition (OCR) is then applied on the ROI using pytesseract. (Instead of Tesseract engine, Google Vision or Azure Vision could also be used).
- Tonumoy Mukherjee tonumoymukherjee2@gmail.com
© Tonumoy Mukherjee
Licensed under the MIT License.