In this task, we have been required to recognize the content of a small text document. A receipt from supermarket or electricity bill cheque should be fine.
Prerequisites:
- Python 3.10 or higher
- Libraries: OpenCV, NumPy, Torch, torchvision, EasyOCR, Matplotlib
- A camera or an image file of a skewed document (e.g., receipt or bill)
- Clone the repository:
git clone https://github.com/ADA-GWU/a5-object-detection-aliasgerovs.git
cd a5-object-detection-aliasgerovs
- Install the required Python packages:
pip3 install -r requirements.txt
To run the text recognition:
Execute the script from the command line
python3 recognition.py
- Follow the on-screen instructions to select the corners of the document in the displayed window.
- Press "p" to process the image after selecting the corners.
- Perspective Transformation: Converts the trapezoidal shape of the document to a rectangular form using manually selected corners.
- Text Detection: Utilizes the MSER algorithm to detect regions likely to contain text.
- Text Recognition: Applies a pre-trained CNN to recognize the detected text.
- Visualization: Shows the processed images and detected text regions with recognized text.
- text_recognition.py: Contains the main logic for image processing, text detection, and recognition.
- images folder: Contains images.