Managing the entry and exit of cars in parking lots is a difficult job. It becomes even more complicated when one wishes to keep track of them using details such as date, time and number plate. Often a dedicated staff is required who can check these details and do data entry.
So today we will make a concept project that will automate the whole process involved in managing a car parking lot by recognising the car number plate, capturing its image, extracting the number from the licence plate and saving them into a database.
Bill of Materials
Let’s start the project by collecting the following components:
First we need to install some Python modules that will help in capturing images using a camera, process them and extract the licence plate number. To do so, open the lxterminal and run the following commands.
sudo apt-get install pytesseract sudo pip3 install opencv2 Sudo Pip3 install numpy
Open the Python IDE and import the following required libraries in the code:
After this, create a while loop in which the captured video is converted into frames and then resized into smaller sizes for faster processing. Next, convert the images into grayscale as this will help in recognising the car number plate and easily extract the text from the image.
Then call the Pytesseract to recognise the number from the number plate after which save the date, time and the identified number of a car number plate in a text file. Also save the picture of the car in the folder named car number plate.
After finishing coding and saving it, connect the camera to the Raspberry Pi cam port using a ribbon cable. Run the code and bring an image of a car number plate in front of it. The camera will automatically capture the image, recognise it and save it in text format with date and time.