# Smart Parking System with Automated Vehicle Log Using Haar Cascade Classifier ANPR

S. Gopikrishnan, Abhiram Kalyan Madduru, Kaushik Karamsetty, Dinesh Rohit Ravuri

► To cite this version:

S. Gopikrishnan, Abhiram Kalyan Madduru, Kaushik Karamsetty, Dinesh Rohit Ravuri. Smart Parking System with Automated Vehicle Log Using Haar Cascade Classifier ANPR. 6th International Conference on Computational Intelligence in Data Science (ICCIDS), Feb 2023, Chennai, India. pp.266-286, 10.1007/978-3-031-38296-3_21. hal-05466047

HAL Id: hal-05466047

https://inria.hal.science/hal-05466047v1

Submitted on 19 Jan 2026

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
<figure><img src="image_2.png" /></figure>

ifip

International Federation for Information Processing

This document is the original author manuscript of a paper submitted to an IFIP
conference proceedings or other IFIP publication by Springer Nature. As such, there
may be some differences in the official published version of the paper. Such
differences, if any, are usually due to reformatting during preparation for publication or
minor corrections made by the author(s) during final proofreading of the publication
manuscript.
Smart Parking System with Automated
Vehicle Log Using Haar Cascade
Classifier ANPR

S. Gopikrishnan(✉), Abhiram Kalyan Madduru, Kaushik Karamsetty, and Dinesh Rohit Ravuri

School of Computer Science and Engineering, VIT-AP University,
Amaravati 522237, Andhra Pradesh, India

gopikrishnan.s@vitap.ac.in

**Abstract.** Recent developments in intelligent transportation systems and GPUs for deep learning computation have made Automatic vehicle Number Plate Detection and Recognition (ANPR) a fascinating area for academic inquiry. ANPR has several transportation uses. Computer vision and AI systems might recognise car licences. This article discusses the Automated Log System we constructed and the ANPR algorithm we utilised to get better results. This study detects licence plates using the Haar cascade classifier. OCR licence plate text. Haar feature-based cascaded classifiers are used to recognise and track automobiles in real-time. Haar characteristics are utilised to represent an image's look. Calculated by removing the total of black and white pixels. The difference utilised to detect picture object existence. EasyOCR is our text extraction method. We constructed a MySQL database log system to record vehicle information and python computer vision technology to analyse and recognise licence plates in real time.

**Keywords:** Automatic License Plate Recognition · Machine

Learning · Image classification · Text Recognition · Vehicle Automation

# 1 Introduction

The Automatic License Plate Recognition (ALPR) system is a significant area for study in the fields of image recognition and intelligent transportation systems. License plate readers employ optical character recognition (OCR) technology to quickly and accurately decipher vehicle registrations. In order to automatically identify and monitor cars as they enter and depart a facility, ANPR systems are often employed in parking garages, toll booths, and traffic control systems.

An automated vehicle entry system using ANPR typically consists of a cam-
era, a processor, and a database. The camera is mounted at the entrance of the
facility and captures images of the license plates of incoming vehicles. The licence
plate's characters are read using optical character recognition (OCR) software,
which then gets converted into text by the processor. The text is then compared to a database of allowed cars, and the system decides whether or not to provide access to the vehicle based on whether or not the licence plate number matches an entry in the database.

## 1.1 Application of ANPR

There are many potential applications for an automated vehicle entry system using ANPR, including improving security at gated communities, enhancing the efficiency of parking garages and toll booths, and automating the collection of tolls on highways. ANPR systems can also be used to enforce parking regulations, track the movements of vehicles, and identify vehicles that have been reported stolen or involved in criminal activity. There are several advantages to using ANPR technology:

**Increased Efficiency:** ANPR systems can process license plate numbers automatically and quickly, reducing the need for manual entry and improving the speed and efficiency of vehicle entry and exit processes.

**Enhanced Security:** ANPR systems can be used to grant access to authorized vehicles only, improving security at gated communities and other facilities.

**Automated Toll Collection:** ANPR systems can be used to automatically collect tolls on highways, eliminating the need for drivers to stop and pay manually.

**Vehicle Tracking:** ANPR systems can be used to track the movements of vehicles, which can be useful for law enforcement agencies and other organizations that need to monitor vehicle activity.

**Reduced Fraud:** ANPR systems can be used to prevent fraud by ensuring that only authorized vehicles are granted access to a facility or are allowed to use a toll road.

**Enhanced Customer Service:** ANPR systems can be used to improve customer service by reducing wait times and eliminating the need for manual payment at toll booths and parking garages.

**Data Collection:** ANPR systems can collect data on vehicle movements, which can be useful for traffic management and other purposes. Automated vehicle entry systems can be used in a variety of settings to improve security, efficiency, and convenience. Some common uses of automated vehicle entry systems include:

**Gated Communities:** Automated vehicle entry systems can be used to grant access to authorized vehicles only, improving security and safety at gated communities.

**Parking Garages:** Automated vehicle entry systems can be used to streamline the process of entering and exiting parking garages, improving efficiency and reducing wait times.
**Toll Booths:** Automated vehicle entry systems can be used to automatically collect tolls on highways, eliminating the need for drivers to stop and pay manually.

**Traffic Management:** Automated vehicle entry systems can be used to track the movements of vehicles and collect data on traffic patterns, which can be useful for traffic management and planning purposes.

**Law Enforcement:** Automated vehicle entry systems can be used by law enforcement agencies to monitor vehicle activity and identify vehicles that have been reported stolen or involved in criminal activity.

**Commercial and Industrial Facilities:** Automated vehicle entry systems can be used to grant access to authorized vehicles only at commercial and industrial facilities, improving security and safety.

## 1.2 Challenges in ANPR and Motivation

There are several challenges that can be faced when using non-automated vehicle entry systems: Time-consuming: Non-automated systems may require manual input or intervention to grant access, which can be time-consuming for users and staff.

**Error-Prone:** Manual processes can be prone to errors, such as incorrect data entry or misplacing physical keys or badges.

**Inefficient:** Non-automated systems may not be as efficient as automated systems, which can lead to delays and bottlenecks in the flow of traffic or other processes.

**Security Risks:** Non-automated systems may be less secure than automated systems, as they may rely on physical keys or badges that can be lost or stolen.

**Cost:** Non-automated systems may be cheaper to implement initially, but they may require more ongoing maintenance and labor costs due to the manual nature of the processes.

**User Frustration:** Users may find non-automated systems frustrating to use, particularly if they are slow or require additional steps to be taken to gain access.

So to avoid all these challenges we have worked on an automated vehicle log system to keep track of the vehicle's entry with a camera placed in the entrance of the parking management systems, Gates of communities, etc. in real time. This system uses automated license plate detection and computer vision to make logs of vehicles in realtime and store the information in a database.

## 1.3 Problem Statement

Traffic issues are inevitable given the increase in the number of vehicles on the road. This is because the built parking facilities and present transit infrastructure are inadequate to manage the increased number of automobiles on the road. It
makes it difficult for anybody working at a gate to identify cars and keep records. Additionally, doing this took a lot of time. An automated system for controlling car access into buildings or public parking lots is really necessary. Keeping track of the entry and exit times of vehicles. Creates a text log for cars entering and leaving the building, which solves administrative problems. This aids in tracking vehicle entry, exit, and the number of cars on the property, which is useful for fleet management. The system features a feature that allows records to be kept for a specific amount of time. Compared to conventional approaches, it offers a quick, effective, and reliable way to detect the presence of cars on a property. As a result, the project's goal is to put in place a system that checks the vehicle's entrance status automatically. The vehicle's number plate is recognized throughout the verification process utilizing image processing (Utilize ANPR to extract the number from these images) with a timestamp, we then add the new vehicle's data to the database.

## 1.4 Contributions Made in this Article

In this paper we will discuss the implementation of the Automated log System we built and the ANPR algorithm we used that provided us with better results. We use the Haar cascade classifier to detect the license plate in this paper, and OCR to extract the text from the recognized license plate. Haar Feature-based cascaded classifiers are often used in vehicle detection and tracking systems to detect and track vehicles in real-time. Haar features are simple features that are used to represent the appearance of an object in an image. They are calculated by subtracting the sum of pixels in a black region from the sum of pixels in a white region. The resulting difference is used to determine the presence of an object in an image. The text extraction process followed in our system is EasyOCR. We have created the log system in MySQL database to store the details of the vehicles and computer vision technologies of python to implement the realtime analysis and recognition of license plates.

## 2 Related Study

There has been a significant amount of investigation carried out in the area of ALPR [2, 8, 9, 17, 18]. The detection of a vehicle's licence plate produces a bounding box around the associated vehicle identification number in the picture. The currently available algorithms make use of morphological categorization approaches, which classify the picture in one of four different ways: edge-based [2], color-based [13], texture-based [5], and character-based [1, 10]. Plate detection often makes extensive use of edge detection as one of its many useful features. Edge detection is helpful in identifying a licence plate since the characters on the plate are formed by a dense black dot matrix set against a white backdrop. The edge density of the black letters on the white backdrop may be determined through edge-based methods. Even though computation is quick, the technique for edge detection is very sensitive to edges that aren't desired. This
may occur if the picture has a lot of various colours or if the contrast between
black and white causes problems with edge detection.

Differentiating between the colours of the automobile body and the licence
plate is the foundation of color-based techniques. Su et al. [20] suggested using
an HSI colour model to identify potential licence plate areas. The histogram is
then used to confirm the identification of the licence plate. By directly learning
character properties from the picture, character-based techniques identify the
objects using the string of characters. CNN can immediately identify character-
istics in the picture. A dependable and quick detector for object detecting issues
is character-based methodology. Most of the authors use methods like Edge
detection, Image binarization, Blob detection, Connected component analysis
for license plate detection.

## 2.1 Edge Detection

Edge detection is a common technique used in ANPR systems to locate the
boundaries of the license plate in an image. There are various edge detection
algorithms that can be used for this purpose, such as the Sobel operator, the
Canny edge detector, and the Laplacian of Gaussian (LoG) operator. These
algorithms work by identifying points in the image where there is a significant
change in intensity or color, which typically corresponds to the edges of objects
in the image.

## 2.2 Binarization Techniques

Image binarization is the process of converting a grayscale or color image into
a binary image, which consists of pixels that are either black or white. This
can be useful for license plate detection systems because it simplifies the image
and makes it easier to process. There are several methods that can be used for
image binarization in license plate detection, including global thresholding, local
thresholding, and adaptive thresholding. Global thresholding involves setting a
fixed threshold value and converting all pixels in the image to black if their inten-
sity is below the threshold, or white if their intensity is above the threshold. This
can work well if the image has a clear separation between the foreground (e.g.,
the license plate) and the background, but it may not be effective if the image
has a more complex or varied intensity distribution. Local thresholding involves
setting the threshold for each pixel based on the intensity of its neighboring
pixels. This can be more robust than global thresholding because it takes into
account the local variations in the image. Adaptive thresholding involves setting
the threshold for each pixel based on an estimate of the local mean or median
intensity. This can be effective for images with non-uniform illumination or other
variations in intensity.

## 2.3 Blob Detection

The process of blob identification in computer vision includes recognizing linked
areas of pixels within an image that share particular properties, such as colour or
intensity. This may be accomplished by comparing the pixels in each region. This
can be useful for automatic number plate recognition (ANPR) systems because it
can help to isolate the license plate from the rest of the image and make it easier
to recognize the individual characters on the plate. There are various algorithms
that can be used for blob detection, including the Laplacian of Gaussian (LoG)
operator, the Difference of Gaussians (DoG) operator, and the Scale Invariant
Feature Transform (SIFT). These algorithms work by identifying points in the
image where there is a significant change in intensity or color, which typically
corresponds to the edges of objects in the image.

## 2.4 Morphology

Morphology is a set of image processing techniques that can be used to enhance
the quality of images or extract specific features from them. One way in which
morphology can be used in ANPR is to pre-process the input images to remove
noise and improve the contrast, making it easier to accurately identify and
extract the license plate numbers. This can be done using techniques such as
erosion, dilation, opening, and closing.

Another way in which morphology can be used in ANPR is to extract the
specific features of the license plate numbers, such as the characters and the
boundaries of the plate. This can be done using techniques such as connected
component analysis, which can be used to identify and label connected regions
in the image, and shape analysis, which can be used to extract specific features
based on the shape of the region. Overall, morphology is an important tool in the
development of ANPR systems, as it allows for the improvement of the quality
of the input images and the extraction of specific features, making it easier to
accurately recognize and extract the license plate numbers.

## 2.5 Connected Component Analysis

Connected component analysis is a technique used to identify connected regions
in an image. It can be used to identify and extract individual objects or features
in an image, such as the characters on a license plate in an automatic number
plate recognition (ANPR) system. To perform connected component analysis,
the image is first converted to a binary image, where pixels are either foreground
(object of interest) or background. The algorithm then processes the image and
groups together connected pixels into components. Each connected component is
assigned a unique label, and the resulting image is a "labeled image" where each
pixel has a value corresponding to the component it belongs to. There are several
algorithms that can be used to perform connected component analysis, including
flood fill, union-find, and graph-based approaches. The choice of algorithm will
depend on the specific requirements of the ANPR system and the characteristics
of the images being processed.
## 2.6 Literature Survey

The method that is outlined in [14] is a multi-stage procedure for locating and identifying licence plates in CCTV video. Finding the image's contours and linked components is the first stage, which may be accomplished via the use of methods such as edge detection and connected component analysis, both of which were discussed previously on this page. The second stage includes picking a rectangular region based on its size and aspect ratio. This may assist to filter out noise and concentrate on areas of the picture that are likely to contain licence plates. The third step involves initial learning for adaptive camera distance/height, which is a process of adjusting the detection algorithm to account for variations in the distance between the camera and the licence plates as well as changes in the lighting conditions. This is done in preparation for the fourth step, which involves initial learning for adaptive camera distance/height. Localization based on the histogram, gradient processing, and the closest mean classifier are all components of the fourth phase. Histogram analysis may be used to find patterns in the picture data, such as the distribution of pixel values, which can assist to discriminate between the various categories of items. This can be accomplished by using a computer programme. The analysis of the variations in pixel intensity throughout an image is referred to as gradient processing. This kind of processing may be helpful for locating edges and other characteristics of an image. The closest mean classifier is a machine learning approach that may be used to categorise the detected areas based on their properties, such as their size and shape. This can be done by comparing the detected regions to a known standard. After all of these stages have been finished, the final detection result is sent on to be tracked, which entails following the licence plate that has been detected as it travels through the scene. Object tracking and Kalman filtering are two examples of methods that may be used to accomplish this goal. These methods make it possible to forecast the path of the licence plate and keep precise monitoring of it even when the plate is partly obscured or moving fast.

The approach described in [4] provided involves using the feature salient method to extract the vehicle number plate from an image by using shape, texture, and color as salient features. Salient features are characteristics of an object that make it stand out from the background and are useful for identifying and extracting the object from the image. The authors used Hough transform (HT) to detect vertical and horizontal lines in the image, which can be useful for identifying the rectangular shape of the number plate. The image was then processed by converting it from the RGB color space to the hue-intensity-saturation color space, which can help to emphasize certain features and make them more visible. Finally, the number plate was segmented, or separated from the rest of the image, using the detected lines and other features.

The approach described [21] provided involves using texture characteristics to extract the characters from the license plate in Indian conditions. Texture characteristics refer to the patterns and structures in the image data that can be used to differentiate between different types of objects or surfaces. Wavelets
are a type of mathematical function that can be used to analyze and represent
data in a compact form, and they have applications in image processing and
other fields. The authors also used morphological operations, which are image
processing techniques that involve analyzing the shape and structure of objects
in an image. Morphological operations can be used to enhance or extract features
in an image, such as edges, lines, and curves. The authors in [4] used a Sobel edge
detector operator to detect vertical edges in the image, which can be useful for
identifying the boundaries of the characters on the license plate. The system was
implemented using MATLAB. It is mentioned that this approach was effective
for extracting the characters from the license plate in Indian conditions, but it
may not be as robust to variations in lighting, camera angle, and other factors
that can affect the appearance of the image. Additional processing steps may be
needed to improve the robustness and accuracy of the detection and recognition
process.

The author of the paper [22] made use of heuristics approaches to enable
the identification and extraction of alphanumeric areas from properly detected
licence plates. After that, the author employed optical character recognition
(OCR) to recognise the characters. The authors of [7] addressed the licence
plate detection and recognition (LPR) challenge on still photos of trucks in their
respective articles. In order to increase the ability to recognise licence plates, they
hybridised, or merged, a number of distinct segmentation methods. An approach
was suggested by the author in [16] that was based on a mix of morphological
operations, segmentation, and Canny edge detection. The method of character
identification described in the article [3] is accomplished by using the Hausdorff
distance metric. The plate's position is determined by mathematical morphology,
and the method. Analyzing the forms and structures of the things that may be
seen in a picture is the focus of the mathematical subfield of study known as
mathematical morphology.

The described algorithm in [11] is a common approach for extracting license
plate regions from images. The first step of noise elimination helps to remove any
irrelevant or distracting details from the image, which could interfere with the
subsequent steps of the algorithm. Edge detection is then used to identify the
edges of objects in the image. In the third step, the algorithm filters out invalid
rectangle areas based on size, histogram, and other information. This step helps
to eliminate false positive detection and focus on regions that are more likely
to contain the license plate. Finally, the geometric rectification step is used to
obtain the license plate candidate region. This step involves aligning the detected
license plate region with a reference frame, which helps to correct any distortions
or rotations that may have been introduced by the camera or the environment.
By using a fuzzy-based algorithm, the authors aimed to improve the accuracy
and robustness of the license plate extraction process. These approaches can be
effective for detecting and recognizing license plates in images, but they may
not be robust to variations in lighting, camera angle, and other factors that can
affect the appearance of the image.
Real-time applications have also seen the use of Haar feature-based cascade classifiers for the purpose of vehicle detection. Using Haar-SURF mixed features in conjunction with a Gentle AdaBoost classifier is one strategy that has been suggested for the identification of vehicles in the research paper [12]. Vehicle detection in parking situations may also be accomplished with the use of an AdaBoost classifier equipped with Haar feature decision stumps, as described in another technique in [15]. In addition, for real-time vehicle recognition, a multi-scan detection methodology utilising Adaboost with Haar-like features and picture segmentation was suggested in [19]. This technique demonstrated enhanced accuracy in comparison to typical Adaboost techniques. ‘Vehicle Detection using active learning and Symmetry’, or VeDAS for short, is a technique that can identify partial back views of automobiles. It makes use of Haar-like characteristics and may be found in [6]. These are just a few instances of the many applications that have been found for Haar feature-based cascade classifiers when it comes to the identification of vehicles.

## 3 Automatic Vehicle Log Using Haar Cascade Classifier

Automated log system which we built uses a pre-trained Haar Cascade Classifier for license plate detection in real time. Open computer vision (OpenCV) library in python has pre-trained models for object detection in an image. And finally we used EasyOCR library for text extraction from the image. The overview of the proposed model is presented in Fig. 1. This paper used various libraries for the implementation of our log system. The main components are as follows:

1. Open Source Computer Vision

2. Haar cascade Classifier

3. EasyOCR

4. MySQL Database

<figure><img src="image_3.png" /><figcaption>Fig. 1. Automatic Vehicle log System Design</figcaption></figure>

### 3.1 Open Source Computer Vision (OpenCV)

OpenCV (Open Source Computer Vision) is a collection of computer vision and machine learning library to support the image processing applications. It
can be used to develop real-time applications for license plate detection. The computer vision in opencv enables us to recognise the number plate in real time. One of the algorithms that OpenCV includes is the cascade classifier algorithm, which can be used for tasks such as face detection, pedestrian detection, and object recognition. In addition to the cascade classifier algorithm, OpenCV also includes algorithms for tasks such as image filtering, image segmentation, and image registration. It also includes tools for image and video I/O, as well as tools for manipulating and displaying images and videos. We have used a Haar cascade classifier to detect the license plate in each frame of the video. The Haar cascade is trained to recognize the specific features of a license plate, such as the edges and patterns of the characters. The cascade classifier will return the coordinates of any detected plates, which can then be used to draw a rectangle around the plate in the frame.

## 3.2 Haar Cascades

Haar cascades are a type of machine learning algorithm that is commonly used in object detection tasks. They were developed by Paul Viola and Michael Jones in 2001 and are particularly effective for detecting objects in images. They work by training a classifier to identify specific features or patterns in the input data. The classifier consists of multiple simple classifiers, or “stages”, that are trained to detect certain features or patterns in the input data. Each stage processes the input data and passes it on to the next stage if it meets certain criteria. If the input data does not meet the criteria, it is discarded and the next stage is not executed. Haar cascades are often used in object detection tasks such as face detection, pedestrian detection, and automatic number plate recognition (ANPR). They are particularly effective because they can be trained to detect a wide range of objects, and they are relatively fast and efficient to run. Overall, Haar cascades are a powerful tool for object detection and have been widely used in many applications, including computer vision and image analysis.

## 3.3 Cascade Classifier

The use of a “cascade of classifiers” is a common technique in machine learning algorithms that are designed to detect objects or features in images or other types of data. The idea behind a cascade of classifiers is to reduce the computational burden of applying many classifiers to the input data all at once. Instead, the classifiers are applied one by one, with each classifier performing a simple test on the input data. If the input data meets certain criteria, it is passed on to the next classifier in the cascade. If the input data does not meet the criteria, it is discarded and the next classifier is not executed.

This approach has several advantages. First, it allows the classifier to quickly eliminate false positive detections and focus on regions of the input data that are more likely to contain the object or feature of interest. Second, it reduces the computational complexity of the classifier, making it faster and more efficient to run. Overall, the use of a cascade of classifiers is a useful technique for improving the efficiency and accuracy of object detection and other machine learning tasks.
## 3.4 Cascade Classifier in ANPR

The Haar feature-based cascade classifier is a specific kind of object recognition algorithm that makes use of machine learning in order to recognise items in photographs. It requires training a classifier with a huge number of pictures, both positive and negative, then extracting features using Haar features, and then using Adaboost to choose the best features. The final classifier is comprised of a weighted sum of these characteristics, and it is used in the process of detecting items in photos that do not include them. The authors came up with the idea of a cascade of classifiers so that the procedure could be carried out more quickly and effectively. In this system, the characteristics are divided up into several phases and then applied one at a time. If a window does not pass a stage, it will be thrown away, and the subsequent stages will not be performed on it. Instead of analysing the full image, the algorithm is able to concentrate its efforts on certain areas of the picture where it has a better chance of discovering the item it is looking for.

In general, the Haar feature-based cascade classifier approach is an effective instrument for object identification, and it has been used extensively in a broad range of applications due to its versatility and power. In automated number plate recognition (ANPR) systems, the machine learning method known as a cascade classifier is often used. ANPR stands for automatic number plate recognition. ANPR systems use computer vision techniques to identify and extract vehicle license plate numbers from images or video streams. These classifiers consist of multiple simple classifiers, or “stages”, that are trained to detect certain features or patterns in the input data. Each stage processes the input data and passes it on to the next stage if it meets certain criteria. If the input data does not meet the criteria, it is discarded and the next stage is not executed.

In ANPR systems, a cascade classifier is often used to detect the presence and location of license plates in images. The classifier is trained on a large dataset of images with and without license plates, and each stage of the classifier is designed to identify specific features that are characteristic of license plates. The classifier can then be used to quickly and accurately detect license plates in new images. Overall, the use of a cascade classifier in ANPR systems helps to improve the efficiency and accuracy of license plate detection, making it possible to automate the process of identifying and recording vehicle license plate numbers. The process and the steps we followed are mentioned in the flowchart presented in Fig. 2.

This proposed model used a pre-trained model of Haar cascade classifier. Pre-trained Haar cascade models are models that have already been trained on a large dataset and are available for use without the need for further training. These models are typically trained to detect common objects and are widely used in applications such as face detection, pedestrian detection, and vehicle detection. To use a pre-trained Haar cascade model, you will need to install the OpenCV
<figure><img src="image_4.png" /><figcaption>Fig. 2. Cascade classifier implementation.</figcaption></figure>

library and use its cv2. Cascade Classifier function. You can then load the pre-trained model file and use it to detect objects in images or video streams. It is also possible to fine-tune pre-trained Haar cascades for more specialized object detection tasks by training them on additional data.

There are many pre-trained Haar cascade models available online, and you
can also create your own custom Haar cascade models by training them on your
own dataset using tools such as the OpenCV library. From one such model have
taken the “haar cascade russian plate number” to detect the license plate from
the real-time car footage. Before implementing the Optical Character Recogni-
tion technique we filtered the number plate image extracted with gray scale and
turned it into a binary image. This process helps us in removing the background
noise present in the image and we can get a clearer image without dust particles
and rust. After this we have implemented various OCR techniques like tesseract,
CNN networks but we got the best results and accuracy with easyocr.

3.5 Easy OCR

EasyOCR is a machine learning-based optical character recognition (OCR) library that can be used to extract text from images and convert it into machine-readable form. It is designed to be easy to use and can be integrated into a variety of applications, including document scanning, data entry, and text analysis. It is based on the Tesseract OCR engine and is designed to be highly accurate and efficient. It supports a wide range of languages and can handle images with complex layouts, such as those with tables or multi-column text. EasyOCR can be used to extract text from a variety of image formats, including JPEG, PNG, and TIFF.

EasyOCR is available as a Python library and can be installed using pip.
It is easy to use and requires minimal configuration, making it a convenient
option for developers looking to add OCR functionality to their applications. It
is implemented using Python and PyTorch, and that it can take advantage of
GPU acceleration for faster performance. It's also useful to know that EasyOCR supports OCR for 58 languages and that the developers plan to add support for handwriting recognition in the future and it can be a convenient and accurate tool for extracting text from images and converting it into machine-readable form. It can be useful in a variety of applications, including document scanning, data entry, and text analysis. If you need to perform OCR on a large number of images, you may find EasyOCR to be a fast and efficient solution. Figure 3 Explains the steps and process involved in our OCR from the license plate recognized by the Haar cascade classifier.

<figure><img src="image_5.png" /><figcaption>Fig. 3. Steps involved in our Optical Character Recognition</figcaption></figure>

## 3.6 DateTime Library

The Python datetime library can be used to perform various operations related to dates and times in a Python program. Some common uses of the datetime library in real-time calculations include:

- Getting the current date and time: You can use the datetime.datetime.now() function to get the current date and time in the local time zone. This can be useful for logging or other applications that need to record the current time.

- Formatting dates and times: You can use the strftime() method to format dates and times as strings in a variety of different formats. This can be useful for displaying dates and times to users or for storing them in a specific format in a database.

- Calculating time differences: You can use thetimedelta class to calculate the difference between two datetime objects. This can be useful for tasks such as measuring the duration of an event or calculating the time remaining until a deadline. Converting between time zones: You can use the "pytz" library to convert between different time zones. This can be useful for applications that need to handle dates and times in multiple time zones.

Overall, the datetime library is a powerful tool for working with dates and times in Python and can be used in a wide range of applications that require real-time calculations. So, Finally using all these components we've built our vehicle log system and use MySQL as a database to store and maintain the log.
## 3.7 Uses of MySQL

MySQL is a well-known relational database management system (RDBMS) that is available for free download and is often used for the purposes of storing, arranging, and managing data. It is a common choice for a log system because it is fast, reliable, and easy to use. There are several ways in which MySQL can be used for a log system:

- Storing log data: MySQL can be used to store log data in a structured manner, allowing for easy retrieval and analysis of the log data.

- Querying log data: MySQL provides a powerful query language, SQL (Structured Query Language), which can be used to extract specific log data from the database. This allows for complex queries to be run on the log data, enabling users to easily extract the information they need.

- Data visualization: MySQL can be used in combination with a visualization tool, such as Tableau or Grafana, to create visual representations of the log data. This can be useful for identifying trends, patterns, and anomalies in the log data.

- Alerting: MySQL can be used to trigger alerts based on specific log data. For example, if the log data indicates that an error has occurred, an alert can be sent to the appropriate team or individual to address the issue.

MySQL is a strong tool to manage and analysing log data, and it is often used in log systems owing to its adaptability, dependability, and simplicity of use. If you want to connect Python to a MySQL database, you may do so by using the mysql-connector-python package. With the aid of this library, which provides a Python-based interface for connecting with MySQL databases, you will be able to run SQL queries and acquire the results. Additionally, you will be able to retrieve the results. From inside a Python application, it is possible to connect to and interact with a MySQL database via the usage of the mysql-connector-python package. Some common uses of this library include:

- Executing SQL queries: You can use the mysql-connector-python library to execute any type of SQL query, including SELECT, INSERT, UPDATE, DELETE, and others. This can be useful for a variety of purposes, such as querying data from a database, inserting new records, updating existing records, and deleting records.

- Retrieving query results: After executing a SELECT query, you can use the fetchall() method to retrieve the results of the query as a list of rows. You can then iterate over the rows and process the data as needed.

- Managing transactions: The mysql-connector-python library provides support for managing transactions, which allows you to execute multiple SQL statements as a single unit of work. This can be useful for ensuring the consistency and integrity of the data in your database.

- Storing and retrieving large amounts of data: The mysql-connector-python library can be used to store and retrieve large amounts of data in a MySQL database. This can be useful for applications that need to store and process large datasets.
Overall, the mysql-connector-python library is a powerful tool for interact-
ing with MySQL databases from Python and can be used in a wide range of
applications.

4 Experiments and Results

4.1 Read in Image, Grayscale and Blur

It is a method for converting pictures that may be used with digital photography.
After removing all traces of colour information, what's left are a variety of shades
of grey, with white being the lightest and black the darkest possible hue. It makes
it easier to simplify algorithms and eliminates the complications connected with
computation requirements all at the same time.

It promotes straightforward visualisation. Due to the fact that it focuses largely on two spatial dimensions rather than three, it is able to differentiate between the shadow details and highlight features of an image. In addition to that, the colour complexity is reduced. Calibration of the camera is required for a variety of reasons, including the production of typical 3D images. The conversion from black and white to grayscale is quite helpful. The process of converting an image to grayscale, which is a sort of black and white picture in which the intensity of each pixel is represented by a single number ranging from 0 (black) to 255 (white), is referred to as grey scaling. Grayscale images may be created by converting an image to grayscale (white). Gray scaling an image can be useful for a variety of purposes, including:

- Reducing the complexity of image processing: Gray scaling an image reduces the amount of data that needs to be processed, making it easier and faster to perform image analysis tasks.

- Improving the contrast of an image: Gray scaling can be useful for enhancing the contrast of an image, making it easier to see details and distinguish between different objects.

- Facilitating machine learning tasks: Many machine learning algorithms are designed to work with grayscale images, so converting an image to grayscale can be useful for preparing it for machine learning tasks.

In the context of licence plate recognition, grey scaling is a technique that
may be used to facilitate the identification and extraction of a licence plate from
an image in a more streamlined manner. It may be simpler to recognise the
borders of the licence plate and differentiate it from the backdrop if the picture
is converted to grayscale. Gray scaling may also make it simpler to carry out
image analysis activities such as optical character recognition (OCR) on the
characters seen on licence plates. It makes learning much easier, particularly
for those who have little or no prior experience with image processing. This is
because grayscale compression strips an image down to its most fundamental
pixel level, which is why this is the case.
## 4.2 Test Case-1

Here are some real life images of cars which we have used to implement our system. These images are taken by us and are not from the internet. The car we used here has the number plate: AP39HG8503 (Fig. 4).

<figure><img src="image_6.png" /><figcaption>**Fig. 4.** Case 1: (a) Original Image of the car (b) Edge detection applied to the car image</figcaption></figure>

**Apply Filter and Find Edges for Localization** The line dividing two items in the picture is called their edge (contour). Edge detection is therefore helpful for locating or quantifying objects, as well as for segmenting the image. Rapid changes in pixel intensity are a defining feature of edges. One can plainly observe that the industrial piece's contour exhibits a sharp drop in pixel brightness (Fig. 5).

<figure><img src="image_7.png" /><figcaption>**Fig. 5.** Case 1: (a) Edge detection applied to the car image (b) Image of the number plate with gray scaling applied (c) Filtered number plate with Edge Detection</figcaption></figure>
The edge detection of the car is used to recognise the number plate but in our model we have used a Haar cascade classifier; this is a reference method that can be used to detect License plates.

**Use EasyOCR to Read Text** EasyOCR like any other Optical character recognition detects the text from images but in my reference. EasyOCR supports 42+ languages for text detection. After detecting the number and applying the mask we use easyOCR to Extract the text from the number plate (Fig. 6).

<figure><img src="image_8.png" /><figcaption>Fig. 6. Case 1: (a) Car number plate detected in real time along with timestamp. (b) OCR Text recognition of number plate</figcaption></figure>

**Render Result** Now we maintain a log of vehicles. We maintain the entry time and exit time of vehicles. We also maintain the status of the car whether it is in or out.

## 4.3 Test Case-2

We have added another example of a number plate which has been detected by our log system. In this example we've recognised the license plate from a closed range to get a better quality image. Thus, we received a better and exact output of the number plate (Fig. 7).

The number plate is detected using the pre-trained haar cascade model as shown in the Fig. 7b.

## 4.4 Results Obtained and Objectives Achieved

The results obtained by our real time vehicle log system are shown in Fig. 8b. We have created a table in the MySQL database which stores the number plate, Entry time and Exit time of the particular vehicle. We can also find the status of the vehicle, whether the vehicle is inside the gateway or out of it. The table
<figure><img src="image_9.png" /><figcaption>**Fig. 7.** Case 2: (a) Original Image of the car (b) Image of the number plate with gray scaling applied (c) Filtered number plate with Edge Detection (d) OCR Text recognition of number plate</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>**Fig. 8.** Case 2: (a) Number plate detected using Haar cascade classifier. (b) Database Log of vehicles with timestamp</figcaption></figure>

we've created stores the entries of the vehicle uniquely. When a same vehicle enters through the gateway we'll get a different record of logs even though the number plate of the vehicle is the same. We can analyze this data and we can find when a particular vehicle has made an entry through the gate, count the number of times the vehicle crosses the gateway. This data can be achieved with simple SQL queries.
clearer images through cameras to detect the license plate more accurately. These
are things that can be improved in the future, and with technology advancing
rapidly, there is never a dead end to getting better results.

References

1. Alkawsi, G., Baashar, Y., Alkahtani, A.A., Kiong, T.S., Habeeb, D., Aliubari, A.: Arabic vehicle licence plate recognition using deep learning methods. In: 2021 11th IEEE International Conference on Control System, Computing and Engineering (ICCSCE), pp. 75–79. IEEE (2021)

2. Anagnostopoulos, C.N.E., Anagnostopoulos, I.E., Psoroulas, I.D., Loumos, V., Kayafas, E.: License plate recognition from still images and video sequences: a survey. IEEE Trans. Intell. Transp. Syst. 9(3), 377–391 (2008)

3. Basha, S.S., Dubey, S.R., Pulabaigari, V., Mukherjee, S.: Impact of fully connected layers on performance of convolutional neural networks for image classification. Neurocomputing 378, 112–119 (2020)

4. Chen, R.C., et al.: Automatic license plate recognition via sliding-window darknet-YOLO deep learning. Image Vis. Comput. 87, 47–56 (2019)

5. Chen, Z., Yan, L., Yin, S., Shi, Y.: Vehicle license plate recognition system based on deep learning in natural scene. J. Artif. Intell. 2(4), 167 (2020)

6. Galvao, L.G., Abbod, M., Kalganova, T., Palade, V., Huda, M.N.: Pedestrian and vehicle detection in autonomous vehicle perception systems—a review. Sensors 21(21), 7267 (2021)

7. Hou, J., Zeng, H., Cai, L., Zhu, J., Chen, J., Ma, K.K.: Multi-label learning with multi-label smoothing regularization for vehicle re-identification. Neurocomputing 345, 15–22 (2019)

8. Hsu, G.S., Chen, J.C., Chung, Y.Z.: Application-oriented license plate recognition. IEEE Trans. Veh. Technol. 62(2), 552–561 (2012)

9. Jiao, J., Ye, Q., Huang, Q.: A configurable method for multi-style license plate recognition. Pattern Recogn. 42(3), 358–369 (2009)

10. Li, H., Wang, P., You, M., Shen, C.: Reading car license plates using deep neural networks. Image Vis. Comput. 72, 14–23 (2018)

11. Lv, S., Shi, S., Wang, H., Li, F.: Semi-supervised multi-label feature selection with adaptive structure learning and manifold learning. Knowl.-Based Syst. 214, 106757 (2021)

12. Maity, S., Bhattacharyya, A., Singh, P.K., Kumar, M., Sarkar, R.: Last decade in vehicle detection and classification: a comprehensive survey. Arch. Comput. Methods Eng. 29, 5259–5296 (2022)

13. Mathur, N., Mathur, S., Mathur, D.: A novel approach to improve sobel edge detector. Procedia Comput. Sci. 93, 431–438 (2016)

14. Moussa, D., Maier, A., Spruck, A., Seiler, J., Riess, C.: Forensic license plate recognition with compression-informed transformers. In: 2022 IEEE International Conference on Image Processing (ICIP), pp. 406–410. IEEE (2022)

15. Najm, M., Ali, Y.H.: Automatic vehicles detection, classification and counting techniques/survey. Iraqi J. Sci. 1811–1822 (2020)

16. Naveenkumar, M., Vijayaganth, V., Mohan, M.: Number plate detection and recognition using a novel computer vision approach for Indian motor vehicles. In: Journal of Physics: Conference Series, vol. 1916, p. 012009. IOP Publishing (2021)
17. Safaei, A., Tang, H.L., Sanei, S.: Real-time search-free multiple license plate recognition via likelihood estimation of saliency. Comput. Electr. Eng. **56**, 15–29 (2016)

18. Sheng, H., Li, C., Wen, Q., Xiong, Z.: Real-time anti-interference location of vehicle license plates using high-definition video. IEEE Intell. Transp. Syst. Mag. **1**(4), 17–23 (2009)

19. Shi, F., Zhang, T., Zhang, T.: Orientation-aware vehicle detection in aerial images via an anchor-free object detection approach. IEEE Trans. Geosci. Remote Sens. **59**(6), 5221–5233 (2020)

20. Shi, H., Zhao, D.: License plate recognition system based on improved YOLOv5 and GRU. IEEE Access **11**, 10429–10439 (2023)

21. Silva, S.M., Jung, C.R.: Real-time license plate detection and recognition using deep convolutional neural networks. J. Vis. Commun. Image Represent. **71**, 102773 (2020)

22. Zhang, L., Wang, P., Li, H., Li, Z., Shen, C., Zhang, Y.: A robust attentional framework for license plate recognition in the wild. IEEE Trans. Intell. Transp. Syst. **22**(11), 6967–6976 (2020)