0% found this document useful (0 votes)
29 views13 pages

Number Plate

The document outlines a project on Automatic Number Plate Recognition (ANPR) using OpenCV and Tesseract OCR, focusing on vehicle identification for traffic monitoring and law enforcement. It details the methodology, objectives, and program implementation for detecting and recognizing vehicle number plates from images or video streams. The project aims to enhance security, improve traffic management, and integrate with broader systems for efficient urban transportation solutions.

Uploaded by

JM REMILDAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views13 pages

Number Plate

The document outlines a project on Automatic Number Plate Recognition (ANPR) using OpenCV and Tesseract OCR, focusing on vehicle identification for traffic monitoring and law enforcement. It details the methodology, objectives, and program implementation for detecting and recognizing vehicle number plates from images or video streams. The project aims to enhance security, improve traffic management, and integrate with broader systems for efficient urban transportation solutions.

Uploaded by

JM REMILDAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

CSI INSTITUTE OF TECHNOLOGY

Thovalai, Kanyakumari District,

Tamil Nadu- 629 302.

DEPARTMENT OF INFORMATION TECHNOLOGY

NM1093
OPEN CV

NAME :

REGISTER NUMBER :

YEAR : III

SEMESTER : VI

ANNA UNIVERSITY, CHENNAI 600 025


MAY 2025
CSI INSTITUTE OF TECHNOLOGY
Thovalai, Kanyakumari District, Tamil Nadu- 629 302.
(Affiliated to Anna University, Chennai – 600 025)

Certificate of Completion

Register Number :

Certified that this is the bonafide record of work done by --------------------------------------


of ----------------------------- year / semester, from Information Technology branch
during the period from February 2025 to May 2025 of the academic year 2024-2025,
for the subject NM1093 – Open CV.

Staff in-charge Head of the Department


(Mrs.S.A.Viji Jasmine) (Dr. K. P. Ajitha Gladis)

Certificate of Submission

Submitted for the Anna university practical examination held at CSI


INSTITUTE OF TECHNOLOGY, THOVALAI on ………………………….

Internal Examiner External Examiner


NUMBER PLATE RECOGNITION

Aim:
To develop an automated system capable of detecting and recognizing
vehicle number plates from images or video streams using OpenCV for image
processing and Tesseract OCR for optical character recognition. The system
aims to facilitate applications in traffic monitoring, law enforcement, and
parking management

Abstract:
Automatic Number Plate Recognition (ANPR) is a critical technology in
intelligent transportation systems, enabling automated vehicle identification for
purposes such as toll collection, access control, and surveillance. This project
implements an ANPR system utilizing OpenCV for image processing and
Tesseract OCR for character recognition.

The process begins with capturing an image or video frame containing a


vehicle. Using OpenCV, the image is preprocessed through grayscale
conversion and noise reduction to enhance the quality for subsequent analysis.
Edge detection techniques, such as the Canny edge detector, are applied to
identify potential regions of interest (ROIs) that may contain the number plate.

Contours are extracted from the edge-detected image to locate rectangular


shapes, which are likely candidates for number plates. Once a potential plate is
identified, the region is cropped and further processed to improve clarity.
Tesseract OCR is then employed to extract the alphanumeric characters fromthe
detected plate region.

The system's performance is evaluated based on its accuracy in detecting


and recognizing number plates under various conditions, including different
lighting, angles, and plate designs. The integration of OpenCV and Tesseract
provides a robust solution for real-time ANPR applications.
Objectives:

1. Automated Vehicle Identification


NPR systems aim to automatically detect and recognize vehicle license
plates from images or video streams. This process involves several key steps:

• Plate Localization: Identifying and isolating the region of interest that


contains the license plate.
• Plate Orientation and Sizing: Adjusting the detected plate to a standard
orientation and size.
• Normalization: Enhancing the image quality by adjusting brightness and
contrast to facilitate better character recognition.
• Character Segmentation: Isolating individual characters on the license
plate.
• Optical Character Recognition (OCR): Converting the segmented
characters into machine-readable text.

These steps collectively enable the system to accurately identify and


extract license plate information from various vehicle images.

2. Enhanced Security and Law Enforcement


NPR systems play a crucial role in law enforcement and security applications:

• Crime Detection and Prevention: By comparing detected plates against


databases of stolen or wanted vehicles, authorities can quickly identify and
respond to potential threats.
• Real-Time Surveillance: NPR systems can monitor vehicle movements in
real-time, aiding in the detection of suspicious activities and enhancing
situational awareness.
• Evidence Collection: Captured license plate data can serve as valuable
evidence in investigations and legal proceedings.

These capabilities contribute to a safer environment by enabling prompt


responses to criminal activities.

3. Efficient Traffic and Parking Management


NPR systems facilitate the efficient management of traffic and parking:

• Automated Toll Collection: By recognizing license plates, NPR systems


can automate toll collection processes, reducing congestion and improving
traffic flow.
• Parking Management: NPR enables automated entry and exit logging in
parking facilities, streamlining operations and enhancing user experience.
• Traffic Flow Monitoring: Analyzing vehicle movements helps in
understanding traffic patterns, which can inform infrastructure planning
and congestion management strategies.

These applications contribute to more organized and efficient urban


transportation systems.

4. Integration with Broader Systems


NPR systems can be integrated with other technologies to provide
comprehensive solutions:

• Database Integration: Linking NPR systems with vehicle registration


databases allows for the verification of vehicle information and ownership
details.
• Data Analytics: Collected license plate data can be analyzed to gain insights
into traffic patterns, peak usage times, and other metrics, aiding in decision-
making processes.
• Access Control Systems: Integrating NPR with access control systems
enables automated entry to restricted areas based on vehicle authorization.

Such integrations enhance the functionality and applicability of NPR


systems across various sectors.

5. Scalability and Adaptability


OpenCV-based NPR systems offer scalability and adaptability:

• Scalability: The system can be scaled to cover multiple entry points or


large areas, accommodating growing security needs.
• Adaptability: OpenCV's flexibility allows for customization to handle
different license plate formats, environmental conditions, and specific
application requirements.

These attributes make OpenCV-based NPR systems suitable for a wide range
of applications, from small parking lots to large urban surveillance networks.
Methodology:
1. Image Acquisition:
Capture or load an image containing a vehicle.

2. Preprocessing:
o Convert the image to grayscale.
o Apply a bilateral filter to reduce noise.
o Use Canny edge detection to highlight edges.
3. License Plate Detection:
o Find contours in the edge-detected image.
o Sort contours by area and approximate each to a polygon.
o Identify the quadrilateral contour representing the license plate.
4. Masking and Cropping:
o Create a mask for the license plate region.
o Apply the mask to extract the license plate area.
o Crop the region of interest from the original images.
5. Optical Character Recognition (OCR):
o Initialize EasyOCR with the English language model.
o Perform OCR on the cropped license plate image.
o Extract and display the recognized license plate text.
6. Post-Processing
o Overlay the recognized text onto the original image.
o Draw a bounding box around the detected license plate.
o Display the final annotated image.

Tips for Improved Accuracy


• Lighting Conditions: Ensure adequate lighting to minimize
shadows and reflections.
• Camera Quality: Use high-resolution cameras to capture clear
images.
• Plate Variations: Train the OCR model with diverse license
plate samples to handle different fonts and styles.
• Preprocessing Adjustments: Experiment with different
preprocessing techniques like histogram equalization or adaptive
thresholding to enhance image quality.
Program:
import cv2
import numpy as np
from google.colab.patches import cv2_imshow # Import cv2_imshow

# Load the image


image = cv2.imread('/content/car', cv2.IMREAD_UNCHANGED) # Try
IMREAD_UNCHANGED

install avif support - see below

# Check if image loaded successfully


if image is None:
print("Error: Could not load image. Check file path and format.") else:
# Resize for consistency
image = cv2.resize(image, (800, 600))

cv2_imshow(image) # Use cv2_imshow instead of cv2.imshow


# cv2.waitKey(0) # Remove this line as it's not needed in Colab #
cv2.destroyAllWindows() # Remove this line as it's not needed
in Colab
import cv2
import numpy as np
from google.colab.patches import cv2_imshow # Import cv2_imshow
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) cv2_imshow(gray)

import cv2
import numpy as np
from google.colab.patches import cv2_imshow # Import cv2_imshow
blurred = cv2.GaussianBlur(gray, (5, 5), 0) cv2_imshow(blurred)

# Use cv2_imshow instead of cv2.imshow


# cv2.waitKey(0) # Remove this line as it's not needed in Colab
# cv2.destroyAllWindows() # Remove this line as it's not needed in Colab
import cv2
import numpy as np
from google.colab.patches import cv2_imshow # Import cv2_imshow

edges = cv2.Canny(blurred, 50, 150)


cv2_imshow(edges) # Use cv2_imshow instead of cv2.imshow
# cv2.waitKey(0) # Remove this line as it's not needed in Colab
# cv2.destroyAllWindows() # Remove this line as it's not needed in Colab

# Load pre-trained Haar cascade for number plates plate_cascade


= cv2.CascadeClassifier(cv2.data.haarcascades +
"haarcascade_russian_plate_number.xml")

# Detect number plates


plates = plate_cascade.detectMultiScale(morphed, scaleFactor=1.1,
minNeighbors=5, minSize=(50, 50))

# If plates found, draw bounding boxes


if len(plates) > 0:
for (x, y, w, h) in plates:
cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 3) plate_img =
image[y:y + h, x:x + w]
cv2_imshow(plate_img) # Display detected plate region
cv2_imshow(image) # Display image with detected plate
import cv2
import numpy as np
from google.colab.patches import cv2_imshow

# Load the image


image = cv2.imread('/content/car')

# Check if image loaded successfully


if image is None:
print("Error: Could not load image. Check file path and format.") else:
# Convert to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

edges = cv2.Canny(gray, 50, 150)

# Find contours
contours, _ = cv2.findContours(edges, cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
contours = sorted(contours, key=cv2.contourArea, reverse=True)
[:10]

# Locate the potential number plate


plate_contour =
None for contour
in contours:
peri = cv2.arcLength(contour, True)
approx = cv2.approxPolyDP(contour, 0.018 * peri, True)
if len(approx) == 4: # Assuming number plate is rectangular
plate_contour =
approx break

# If number plate detected


if plate_contour is not None:
# Extract plate region
x, y, w, h = cv2.boundingRect(plate_contour)
plate_img = image[y:y+h, x:x+w]

# Display only the detected number plate


cv2_imshow(plate_img)

else:
print("Number plate not found.")

Model Selection:
When selecting a model for number plate recognition using OpenCV, it's
essential to consider factors like accuracy, speed, and ease of integration. Here
are some recommended approaches based on recent research and practical
implementations:

1. YOLO (You Only Look Once) Models


YOLO is a popular choice for real-time object detection due to its speed
and accuracy. Recent implementations have utilized YOLOv3 and YOLOv8 for
license plate detection. For instance, YOLOv8 has been employed for real-time
license plate number detection, achieving reliable results under various
conditions.

Pros:
• High accuracy and speed.
• Suitable for real-time applications.
• Easily integrates with OpenCV.
Cons:
• Requires a good dataset for training.
• Model size can be large.

2. LPRNet
LPRNet is an end-to-end deep learning model designed specifically for
license plate recognition. It eliminates the need for character segmentation,
streamlining the recognition process. The model has demonstrated high
accuracy, making it suitable for various license plate formats.

Pros:
• High recognition accuracy.
• End-to-end processing without segmentation.
• Efficient for embedded systems.

Cons:
• May require fine-tuning for specific license plate styles.
• Integration with OpenCV might need additional steps.

3. Tesseract OCR with Preprocessing


For simpler applications or when computational resources are limited,
combining OpenCV with Tesseract OCR can be effective. Preprocessing
techniques like thresholding and noise removal can enhance OCR accuracy.
This approach is well-documented and widely used.

Pros:
• Simple to implement.
• Lightweight and fast.
• Suitable for static images.

Cons:
• Lower accuracy compared to deep learning models.
• Struggles with complex or distorted plates.
4. BLPNet (for Bengali License Plates)
For applications targeting Bengali license plates, BLPNet is a specialized
model that combines a deep neural network with a Bengali OCR engine. It
offers high accuracy and is optimized for real-time processing.

Pros:
• Tailored for Bengali license plates.
• High recognition accuracy.
• Real-time processing capabilities.

Cons:
• Not applicable for non-Bengali plates.
• Limited support and resources.

Result:

Thus, develop an automated system capable of detecting and recognizing


vehicle number plates from images or video streams using OpenCV for image
processing and Tesseract OCR for optical character recognition. The system
aims to facilitate applications in traffic monitoring, law enforcement, and
parking management was developed successfully.

You might also like