This simple Python script uses OpenCV and Tesseract OCR to recognize text from a live camera feed. It is specifically designed to identify and display lines of text matching a certain pattern, useful for extracting information from ID cards.
-
Install Python 3.x from python.org.
-
Install required dependencies using the following commands:
pip install opencv-python pip install pytesseract pip install Pillow -
Download and install Tesseract OCR from Tesseract GitHub.
-
Set the Tesseract executable path in the script:
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
-
Run the script using the command:
python idcard.py -
The script captures the default camera feed and extracts text matching a specified pattern.
-
Press 'q' to exit the application.
Feel free to adjust parameters in the script, such as rectangle position and size, based on your specific requirements.
- This script utilizes OpenCV for image processing and Tesseract OCR for text extraction.
