Professional Documents
Culture Documents
1
Components Required
•Raspberry Pi
•Pi Camera
Here only Raspberry Pi and Pi camera are used to build this Raspberry Pi
Plate Recognition System. We previously used Pi camera with Raspberry pi,
and built few projects using it like
Web Controlled Raspberry Pi Surveillance Robot, IoT
based Smart Wi-Fi doorbell, Smart CCTV Surveillance System, etc.
1
PRE-REQUISITES FOR NUMBER PLATE
RECOGNITION OPENCV PYTHON
Here we use the OpenCV library to
detect and recognize number plates,
and the Tesseract library is used to
read the characters. So before
proceeding further, first install the
OpenCV, Tesseract, and other required
libraries. We previously used OpenCV
in Face Recognition using the
Raspberry Pi project.
INSTALLING OPENCV IN RASPBERRY PI
What is Tesseract?
Tesseract is a tool originally developed by
Hewlett Packard between 1985 and 1994, with
some changes made in 1996 to port to
Windows, and some C++ izing in 1998.
Tesseract became open-source by HP in 2005,
and Google has been further developing it since
2006.
plate.
1
LETS LOOK IN TO THE CODE
AND WORKING
At the starting of the code, import the required
packages for this project.
Then initialize the camera object and set the resolution at
(640, 480) and the frame rate at 30 fps.
Then use the capture_continuous function to start capturing
the frames from the Raspberry Pi camera. We are using the
keyboard key ‘S’ to capture a particular frame.
When the keyboard key is pressed, it will take the last frame.
After capturing the last frame, it will use a bilateral
filter function to remove the unwanted details from the
captured image.
After removing the unwanted details, use the Canny Edge
Method to perform edge detection.
Now we will look for contours on our image. After that sort the detected
contours from big to small.
The Raspberry Pi can find multiple contours, so we have to filter the
license plate contour by searching for a rectangle shape contour
with four sides and a closed figure among the obtained results.
After finding the license plate, mask everything except the
license plate
After masking the entire image except the license plate
region, we will crop out the license plate area and save it as a
new image.
When the keyboard key is pressed, it will take the last frame.
After capturing the last frame, it will use a bilateral
filter function to remove the unwanted details from the
captured image.
Now in the final step, read the characters from the license plate
image using the Tesseract library and store the recognized
characters in the ‘text’ variable. As mentioned earlier, we are
also sending a mail when Pi detects a license plate. So the
license plate information will be sent to the mentioned email
address. The code for sending the mail is given below.
THANK YOU ANY QUERIES ?