2025AI

AI Number Plate Recognition & Smart Parking System

An end-to-end ANPR and smart-parking platform - YOLOv8 + Roboflow detection feeding a vision-LLM OCR engine with low-light image enhancement, real-time polygon-based slot occupancy, an ESP32-driven LED matrix and alarm, and a full Stripe booking-and-payment backend. My first hardware project, and a University of Moratuwa top project.

AI Number Plate Recognition & Smart Parking System - AI project by Kalana Sandakelum

This is an AI-powered smart car parking system with integrated automatic number-plate recognition, built as my university final hardware project and selected among the top projects at the University of Moratuwa. It watches a live camera feed, works out which parking slots are occupied, reads the license plate of each parked vehicle, validates it against the Sri Lankan plate format, and records the event - while pushing live updates to an operator dashboard, an on-site LED display, and a cloud booking-and-payment system. It was my first hardware project, and it brings together computer vision, a vision large language model, embedded electronics, a full-stack web backend, and online payments in one working system.

The platform is built from five cooperating subsystems: a Python detection-and-OCR engine that does the computer vision, a Flask backend that exposes a REST and WebSocket API and orchestrates everything, a real-time React operator dashboard, an ESP32-driven LED matrix and alarm for on-site feedback, and a separate Node.js booking-and-payment service. The heavy vision loop runs as an isolated subprocess and talks to the web layer through a shared on-disk state file, which keeps the demanding detection work decoupled from the API and hardware control.

The recognition pipeline is deliberately layered for accuracy. Each frame is run through YOLOv8 to detect vehicles, and a polygon test decides which slot a vehicle occupies. Once a vehicle has stayed in a slot past a trigger delay, the plate region is localized with a hosted Roboflow model, backed by a classical contour-and-edge fallback, the crop is enhanced, and the text is read by an OpenAI GPT-4o-mini vision model running deterministically, with EasyOCR available as a fast local alternative. Every candidate is gated by confidence, validated against the Sri Lankan plate pattern, stripped of provincial codes, and the best valid reading is chosen; if a frame fails, OCR retries on later frames before a vehicle is finally logged as unknown. The accuracy comes from concrete engineering - confidence gating, multi-pass OCR, format validation, and time-based retries - rather than from any single model.

A particular focus was reading plates reliably at night and in poor light. Rather than relying on the camera alone, each plate crop is pushed through a dedicated enhancement stack - CLAHE local-contrast boosting, edge-preserving bilateral denoising, adaptive and Otsu thresholding, morphological cleanup, and cubic upscaling of small or distant crops - so faint, noisy, low-resolution plates become legible before they ever reach the OCR step.

On the parking side, two slots are defined as polygons, and a vehicle is counted as parked when its bounding-box centre falls inside a slot. Exits are confirmed through a short buffer that absorbs brief mis-detections, and a stuck slot auto-resets after a timeout. All of this is mirrored on real hardware: an ESP32 in WiFi mode drives a P10 LED matrix that shows slot status, plate numbers, and entering or leaving messages, and sounds an audible alarm for unauthorized vehicles, all driven from the Python side over a small HTTP command protocol.

Around the live system sits a full booking and payment service built on Node.js, Express, and MongoDB. Users register and log in with token-based authentication, reserve a slot with time-overlap conflict detection, and pay through Stripe Checkout in Sri Lankan rupees, with SMS notifications for confirmations, reminders, and alerts. The booking service and the detection system are integrated in both directions: a live arrival is validated against any active reservation, and a mismatch raises an unauthorized-vehicle alert that lights up the LED display and sends the customer an SMS.

The operator dashboard is a real-time React interface served by Flask and updated over Socket.IO, with live per-slot cards, a searchable parking-record history, a gallery of unreadable vehicles, and runtime controls to start or stop detection and switch the OCR engine. Under the hood the stack spans Python with YOLOv8, OpenCV, PyTorch, Roboflow, and the OpenAI API on the vision side; Flask, Socket.IO, and MongoDB on the backend; the Arduino framework, the DMD32 display library, and I2S audio on the ESP32; and Node.js, Express, Stripe, and MongoDB on the booking side.

Building this end to end - from a camera frame, through detection and OCR, onto a physical LED display, and into a payment checkout - taught me how to make computer vision, embedded hardware, and web services cooperate as one reliable system. The current build runs on a focused two-slot setup, and it is the kind of system I am continuing to harden and extend, toward more slots, true multi-object tracking, and a dedicated night mode.

Built with

PythonYOLOv8OpenCVPyTorchOpenAI GPT-4o-miniRoboflowEasyOCRFlaskSocket.IOMongoDBNode.jsExpressStripeReactESP32

More work

All projects