This Python project utilizes the Tesseract OCR engine through the pytesseract wrapper and the Python Imaging Library (PIL) to perform Optical Character Recognition (OCR) on images. The main goal is to compare the accuracy of OCR results with and without various image preprocessing methods.
- Tesseract OCR Integration: Utilize the Tesseract engine to extract text from images.
- Image Preprocessing: Implement different image preprocessing techniques like erosion, dilation, and color filtering to enhance OCR accuracy.
- Accuracy Measurement: Calculate the OCR accuracy using the Levenshtein distance, providing a metric for comparing different preprocessing methods.
- Python 3.x
- pytesseract
- Pillow (PIL)
- OpenCV
- NumPy
-
Install Python Packages:
-
Tesseract OCR:
- Download and install Tesseract from Tesseract GitHub.
- Ensure the Tesseract path is configured correctly in the script:
pytesseract.pytesseract.tesseract_cmd = r"C:\\Program Files\\Tesseract-OCR\\tesseract.exe"
- Load the Image:
- Place the image you want to process in the project directory.
- Run the Script:
- Execute the Python script to perform OCR on the image.
- Adjust the preprocessing functions as needed to compare different results.
- View Results:
- The script will display the original and preprocessed images along with their OCR results and accuracy.
Contributions to enhance the functionality or the efficiency of the OCR process are welcome. Please ensure to submit a pull request with a clear description of your changes.