License Plate Detection & OCR Experiment
by M.L. "Marty" Danish | August 6, 2023 | Foundations of Computer Vision at Colorado State University Global Campus
Overview
This project implements an end-to-end pipeline to detect and read license plates using OpenCV and Tesseract OCR, as required by the project specifications. It compares performance on Russian (black-and-white) plates versus a non-Russian, multicolored Colorado plate.
Approach
- Plate Localization: Pre-trained Haar-cascade model in OpenCV using the cv2 Python library
- Preprocessing: Grayscale conversion —> adaptive thresholding —> morphological filtering.
- OCR: Tesseract via pytesseract, with confidence-based filtering and conditional preprocessing loops.
Key Outcomes
- Detection
- 100% success on four Russian plates
- 0% detection on the Colorado sample
- OCR First Pass
- One plate yielded the full eight-character string (50% correct)
- Preprocessing Experiments
- Multiple parameter sweeps increased character regions but did not improve recognition accuracy
Challenges and Learnings
- Plate design variance (shape, color) heavily impacts a fixed Haar cascade.
- Static thresholds struggle with multicolored backgrounds and decorative graphics.
- Rule-based OCR pipelines require extensive tuning and still face recognition limits.
Next Steps for Future Work
- Swap Haar cascade for a modern object detector (e.g., YOLOv5) for robust localization
- Add color-space preprocessing (HSV/Lab) to better isolate text on colorful plates
- Evaluate end-to-end trainable OCR models to boost recognition accuracy
Feel free to explore the full write-up and code on GitHub!