Artificial Intelligence API for Car Parking Management System using STM32F407 and Image Processing using OpenCV

By Aparna Vashishtha and Himanshu Sharma

Comment errors or corrections found for this circuit, and get the chance to win big!

Today a car parking system is increasing day by day that multiplies parking capacity inside a building or a parking lot. Parking systems are generally powered by electric motors or hydraulic pumps that move vehicles into a storage position.

There are two types of car parking systems: traditional and automated. In the long term, automated car parking systems are likely to be more cost effective when compared to traditional parking garages. Automatic multi-story automated car park systems are less expensive per parking slot, since they tend to require less building volume and less ground area than a conventional facility with the same capacity. Both automated car parking systems and automated parking garage systems reduce pollution—cars are not running or circling around while drivers look for parking spaces and for all these process a lot of man work is required that not seems to be useful.

A Smart way to manage car parking using OpenCV. Using a smart parking system with image processing technique with OpenCV. Now a days, a Smart Car Parking is must. The project involves a system including infrared transmitter and receiver at entry and exit gates and a boom barrier at gates can be powered by hydraulic system by a microcontroller for car entry and exit. The Smart Car Parking System does all the required work like automatic counting, and opening and closing of the gates without human intervention. When the parking space is full, the gate barrier does not open and cars cannot enter the parking lot.

OpenCV is a library of programming functions for real time computer vision originally and developed by Intel and now supported by Willogarage. Open CV is a cross-platform library, which have been suggested for applying SVMs for multiclass classification. They are “one against all” and “one against one”. A number plate region is located by using mean shift method and extracted; the histogram projection method in horizontal direction is applied for a simple segmentation only.


Automatic license plate recognition is a Computer Vision technique which is able to recognize a license plate number. This system is useful in many field likes parking lots, private and public entrances, theft control. In this paper we designed such a system. First we capture the image from camera then load into system after that we used Open CV library tools.

STM32F407VGT6 microcontroller featuring 32-bit ARM Cortex® -M4 with FPU core, 1-Mbyte Flash memory, 192-Kbyte RAM in an LQFP100 package. On-board ST-LINK/V2 on STM32F4DISCOVERY , USB ST-LINK with re-enumeration capability and three different interfaces: – Virtual COM port. Eight LEDs: – LD1 (red/green) for USB communication – LD2 (red) for 3.3 V power on – Four user LEDs, LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue) – 2 USB OTG LEDs LD7 (green) VBUS and LD8 (red) over-current ,Two push buttons (user and reset) USB OTG FS with micro-AB connector.

Project Description

Fig. 1: Block Diagram of the Proposed System

The circuit consists of STM based STM32F407VGT microcontroller, four infrared (IR) LEDs as IR Transmitters (TX1,TX2,TX3,TX4), four phototransistors (RX1,RX2,RX3,RX4) as sensors, a voltage regulator (7805) and a few discrete components.

Power on-reset for the microcontroller is provided by the combination resistor R37 and capacitor C37. Reset Button B2 is used for manual reset. A 8 MHz external crystal along with 20pf capacitors provide the basic clock frequency to microcontroller STM32F407.

IR LED1 (TX1), IR LED2 (TX2), IR LED3 (TX3) and IR LED4 (TX4) continuously transmit infrared signal which are received by phototransistors T1,T2,T3 and T4. Phototransistors T1,T2,T3 and T4 drive into saturation and so their collectors are at low states. The collectors of phototransistors are connected to the microcontroller’s port pins PA.12,PA.13,PA.14,PA.15 respectively.

When the infrared signal is interrupted by car, T1 and T2 stop conducting, providing a high signal to port pins PA.12 and PA.13 of the microcontroller, respectively, indicating the presence of a vehicle between the IR transmitter-receiver pair. Similarily, for T3 and T4 phototransistors. Port PA.0 and PA.1 of the microcontroller are used to control the barrier gate’s arm. When we give different commands through PC to microcontroller for closing and opening the entry exit gates then port pin PA.0 is high, it drives the transistor BC337 into saturation and LED will glow as barrier entry gate open. We are using a LED to show the barrier gate presence at the entry and exit gates. When Port pin PA.1 is high, it drives the transistor BC337 into saturation and LED will glow as barrier exit gate open. Now, using Open CV car license plate recognition is done.

Fig. 2: PCB of Proposed System
Fig. 3: Circuit Diagram of Car Parking Management System

Automatic License Plate Recognition (ALPR) is a computer vision technology to extract the license number of vehicles from images.

First we capture the image from camera then load into system after that we used OpenCV library tools. Then we make the training set of different characters of different sizes. On the basis of these training set we extracted the character from images. When the license plate is detected, its digits are recognized and displayed in the GUI.

Fig. 4: Block Diagram of the Open CV Technique

1. Capture

The given image of the vehicle is captured by camera which is high resolution quality. We save this image in the system.

Fig. 5: Captured Image


2. Pre-processing

Pre-processing is the technique in which background illumination conditions and the number plate localization algorithms is used. In this phase mainly focuses on reduce background noise, enhancing of contrast.

3. Number Plate Localization

The number plate localization is the phase in which mainly focuses on ROI (Region of Interest) where we find the contour region.

3.1 Contour Tracing

Contours can be explained simply as a curve joining all the continuous points (along the boundary), having same color or intensity. The contours are a useful tool for shape analysis and object detection and recognition. Here we use contours in rectangle shape.

Contour Image
Fig. 6: Contour Image

4. Edge Detection

The edge detection helps us to detect the edges present in an image.

5. Character Segmentation

Character segmentation is the technique in which individual character present in the image is separated out. Here all character is checked out individually.

6. Character Recognition

An automatic license plate recognition system must recognize alphanumeric characters. The character image is compared with the training set and the best similarity is measured and according to this recognized character is displayed.

Recognized Vehicle Plate
Fig. 7: Recognized Vehicle Plate
Registered Information (DATABASE)
Fig. 8: Registered Information (DATABASE)

Developer Profile:

Aparna Vashishtha –
Himanshu Sharma –




Please enter your comment!
Please enter your name here