Description:
This code implements an automated license plate recognition (ALR) system leveraging YOLOv8 for object detection and EasyOCR for optical character recognition (OCR). The pipeline begins with adaptive image preprocessing, enhancing contrast and applying noise reduction for detection, followed by binarization and dilation for OCR optimization. YOLOv8 (trained on a custom dataset) localizes license plates in input images/videos, returning bounding box coordinates. Detected plate regions are cropped, preprocessed, and fed into EasyOCR, which extracts alphanumeric text using a combination of CNNs and LSTMs. A region-based filtering mechanism ensures only text occupying significant plate areas is retained. The system processes video inputs by analyzing every 30th frame to balance performance and accuracy. A Gradio web interface provides interactive visualization, displaying annotated results with bounding boxes, recognized text, and frame-wise video analysis logs.
Input:
Upload either an image (JPG/PNG) or video (MP4/AVI) through the Gradio interface.
Processing
Images: Automatic plate detection → OCR processing → Visual annotation.
Videos: Frame sampling (1-in-30) → Batch processing → Text logging.
Output:
Images: Display annotated plate with bounding box + recognized text.
Videos: Text log showing frame numbers and detected plates.
