This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CONTENTS
INDEX Page No.
TITLE PAGE
ABSTRACT
1. INTRODUCTION TO DIGITAL IMAGE PROCESSING.....................................1
We use the yellow license plate at the back of the car as the input image. We take two sets of
photos with resolution of
1024 * 768 pixels
640 * 480 pixels
Then, the photos are resized to a resolution of 256 * 192 pixels. Although the program does
not take long time to execute, reducing the resolution can reduce the computation time, and at
the same time, the results are still good enough.
192 pixels
256 pixels
PLATE EXTRACTION:
Page | 17
BINARIZATION:
We need to change the color image to binary image first. We change yellow to white and
non-yellow to black.
As RGB color space is greatly affected by light, we cannot use it to determine colors.
Instead, we use CIE-xyz color space [1].
There are two sets of variables:
Set 1 – for brighter / higher resolution image
X = 0.412453 R + 0.357580 G + 0.180423 BY = 0.212671 R + 0.715160 G + 0.072169 BZ = 0.019334 R + 0.119193 G + 0.950227 BSet 2 – for darker / lower resolution image
X = 0.607 R + 0.174 G + 0.201 BY = 0.299 R + 0.587 G + 0.114 BZ = 0.000 R + 0.066 G + 1.117 B
Page | 18
Plate Extraction
Character Segmentation
Character Recognition
Binarization
Find Edges
Hough Transformation
FIND EDGES:
We can use closing operator to outline the four edges of the license plate in the binary image.
1. Canny Edge Detection:
detect gradient change (from black to white; from white to black)
The main criterion of canny edge detection algorithm is:
The first and most obvious is low error rate.
The second criterion is that the edge points be well localized.
A third criterion is to have only one response to a single edge.
2. Dilation:
add a border
3. Filing:
Page | 19
fill in small holes
4. Erosion:
remove most of the dilated pixels (border pixels)
but once the interior holes are filled, they cannot be removed
original size of license plated is unchanged
5. Canny edge detection with threshold
detect gradient change
filter some of the unwanted noise (two dots are removed)
HOUGH TRANSFORMATION:
Page | 20
Hough Transformation is used to detect line. We use two domains to explain it. One
is spatial domain (Fig. 4) and the other is parameter domain (Fig. 5). A line in a spatial
domain is represented by a point in the parameter domain; a point in a spatial domain is
represented by a line in the parameter domain.
Fig. 4 Spatial Domain
Fig. 5 Parameter Domain
We can see that the line in Fig. 4 is represented by a point in Fig. 5. If we take 20
points on the line in Fig. 4, they are represented by 20 lines in Fig. 5. All the 20 lines pass
through one point. We set up an accumulator cell for every pixel (point). For each line
passing the pixel, the accumulator cell is increased by one. Therefore, the accumulator cell is
added up to 20.
Page | 21
Fig. 6 Accumulator Cells
By looking at the accumulator cells, we can see that there is a peak equals to 20. This is the
position of the line in the spatial domain.
A program is written to set up an accumulator array A(r, theta).
r is the longest line possible in the 256 * 192 pixel image, which is given by
floor(sqrt(256^2 + 192^2)) = 320.
360 gives the range of theta we want to examine, begin 1 to 360.
In the image, all the values of x and y are searched through to find any feature points.
Feature points are intensity = 1. That is white in color.
For each (x,y) feature point, all the corresponding (r, theta) points are found.
r negative is not ‘voted for’ in the accumulator cell, otherwise, the accumulator cell is
increased by one.
The maximum value of the A(rm, thetam) array is found and the corresponding (rm, thetam)
values of this maximum value are found.
Then the slope and y-intercept of the found line is calculated.
rm = x cos thetam + y sin thetam [2]
Page | 22
Hough transform will only find the longest / strongest line in an image. To detect the second
longest / strongest line in the image, we need to set the intensity of the found line to 0 first.
That is black in color. And then we can find the next longest / strongest line [3].
Finally, the plate position is found and extracted.
Page | 23
CHARACTER
SEGMENTATION
Page | 24
CHARACTER SEGMENTATION:
3.3.1 Scaling
We use pixel count to remove noise and segment characters. However, the characters
in the photo which taken nearer are larger and contain more pixels (Fig. 8) but the characters
in the photo which taken further are smaller and contain fewer pixels (Fig. 10). Therefore,
we need to scale the extracted license plate to a pre-defined dimension so as to make every
character has roughly the same height and width. As can be seen, after scaling, size of
characters in Fig. 8 is roughly the same as size of characters in Fig. 10. Then we can use
pixel count.
Page | 25
Plate Extraction
Character Segmentation
Character Recognition
Scaling
Horizontal Projection
Vertical Projection
Fine Tuning
Fig. 7 Photo taken nearer
Fig. 8 Extracted license plate
Fig. 9 Photo taken further
Fig. 10Extracted license plate after scaling
Page | 26
HORIZONTAL PROJECTION:
There is always noise around the extracted license plate (Fig. 11), therefore we need
to remove or reduce the noise before segment the characters.
We can use horizontal projection to see the distribution of the pixels (Fig. 12). X-axis is the
height of the license plate (from top to bottom). Y-axis is the pixel count per row of the
license plate [4].
Single Line License Plate:
The noise above and below the characters is usually found less than 15 pixels.
Therefore, we choose 15 as the threshold. Also, there must have more than 10 rows of pixel
which is greater than 15 continuously so as to be considered as useful.
As in Fig. 12, although the first column in the graph (first row in the license plate) is greater
than 15, the second column in the graph (second row in the license plate) is less than 15.
Therefore, these two columns are considered to be noise and discarded.
After removing the noise, the license plate will be cleaner
Fig. 11Extracted license plate with noise
Fig. 12Horizontal Projection
Fig. 13License plate with noise removed
Page | 27
Double Line License Plate:
The noise above the characters is usually found less than 5 pixels. Therefore, we choose 5 as
the threshold. Also, there must have more than 5 rows of pixel which is greater than 5
continuously so as to be considered as useful.
The noise below the characters is usually found less than 15 pixels. Therefore, we choose 15
as the threshold. Also, there must have more than 5 rows of pixel which is greater than 15
continuously so as to be considered as useful.
After removing the noise above and below the plate, we need to separate the top set of
characters and the bottom set of characters.
Each set of characters occupied about half of the plate (Fig. 14, Fig. 15).
To locate the bottom of the top set of characters, we search from the middle and trace left. If
the pixel is more than 5, then it is the bottom of the top set of characters.
To locate the top of the bottom set of characters, we search from the middle and trace right.
If the pixel is more than 15, then it is the top of the bottom set of characters.
After removing the noise, and separate the license plate into two sets, it becomes Fig. 16.
Fig. 14Extracted license plate with noise
Fig. 15Horizontal Projection
Top set of characters with noise removed
Bottom set of characters with noise removed
Page | 28
VERTICAL PROJECTION:
There is always noise around the characters, so we need to distinguish the characters
from the noise.
We can use vertical projection to see the distribution of the pixels (Fig. 18). X-axis is the
width of the license plate (from left to right). Y-axis is the pixel count per column of the
license plate [4].
Ideal Case
There is no noise between the characters (Fig. 17), so there is a sharp valley which pixel
count = 0 (Fig. 18). This is the break point between characters.
To be more precise, we choose 2 as the threshold. Pixel count greater than 2 in a column will
be considered as useful.
By locating these valleys, the positions of the characters are found and segmented (Fig. 19).
Fig. 17No noise between characters
Fig. 18Vertical Projection
Fig. 19Isolated characters
Page | 29
Connected Characters
There is noise between the characters (Fig. 20), so there is no sharp valley and it is difficult to
find the break points.
We need to check the width of each separated characters. If the width of a segmented
character is greater than 20 pixels, it is composed of several characters and need further
segmentation.
Fig. 20Connected characters
Fig. 21Vertical Projection
Fig. 22Isolated characters
Character ‘1’ or noise
Character ‘1’ is easily mixed up with noise. In Fig. 23, the noise at the end of the license
plate may be a character ‘1’.
We need to check the width of each separated characters. We choose 15 as the threshold
If the width of a segmented character is less than 5 pixels, and if the pixel count is greater
than 15, then it is character ‘1’.
If the width of a segmented charter is less than 5 pixels, and if the pixel count is less than 15,
then it is noise and is discarded.
Page | 30
Finally, the positions of the characters are found and segmented (Fig. 25).
Fig. 23Character ‘1’ or noise
Fig. 24Vertical Projection
Fig. 25Isolated characters
Page | 31
G U 8 7 6 7
FINE TUNING
After segmenting the characters, we need further removing the noise and white lines
above and below the characters due to their non parallel arrangement in the photo. Also, we
need to scale every character to the same dimension so that they can be compared with the
templates stored in the data base in the next procedure.
To remove the white lines above and below each character, we use horizontal projection and
set a threshold. If the pixel count is less than the threshold, the row is discarded (characters
‘2’ and ‘5’ in Fig. 26 & characters ‘5’, ‘8’ and ‘4’ in Fig. 28).
To remove the noise on the left and right of the character, we use vertical projection and set a
threshold. If the pixel count is less than the threshold, the column is discarded (character ‘J’
in Fig. 26).
Then the character is scaled to a pre-defined dimension (Fig. 27).
Fig. 26Isolated characters
Fig. 27 Characters after fine tuning
Page | 32
CHARACTER RECOGNITION
Page | 33
CHARACTER RECOGNITION:
TEMPLATE MATCHING:
A list of templates is stored in the databases. There are two databases, one for
alphabet, and the other for numeric characters. These templates are chosen from the isolated
characters. There are two to three templates for each character. They are in high quality and
have outstanding features.
The first two isolated characters are compared with the templates stored in the alphabet
database; the last three to four isolated characters are compared with the templates stored in
the numeric database.
We measure the degrees of matching between the isolated character and each of the stored
templates, and select the highest degree of match. The maximum value of 2D correlation is
equal to 1.
Template characters
Page | 34
Plate Extraction
Character Segmentation
Character Recognition
Template Matching
Component Labeling
Vertical Projection
COMPONENT LABELING:
By using Template Matching, some characters are often mixed up. They are ‘8’ &
‘3’, ‘8’ & ‘6’, ‘8’ & ‘9’ and ‘3’ & ‘9’. Therefore, if a character is matched as ‘3’, ‘6’, ‘8’ or
‘9’ and its correlation value is less than 0.7, it needs to be further recognized by Component
Labeling.
Labeling method
Character ‘3’ has one stroke and no holes – labeled as 1
Character ‘6’ has one stroke and one hole – labeled as 2
Character ‘8’ has one stroke and two holes – labeled as 3
Character ‘9’ has one stroke and one hole – labeled as 2
As can be seen, characters ‘3’ and ‘8’ have different labels, so they can be recognized.
However, characters ‘6’ and ‘9’ have the same label, so they need to be further recognized by
Vertical Projection.
Page | 35
VERTICAL PROJECTION:
To distinguish between characters ‘6’ and ‘9’, we can use Vertical Projection to see
the distribution of the pixels (Fig. 30 and Fig. 31). X-axis is the width of the character (from
left to right). Y-axis is the pixel count per column of the character.
We add up the first four columns and add up the last four columns of the pixels.
If the pixel count of first four columns is greater than the last four columns, it is character ‘6’
(Fig. 30); otherwise, it is character ‘9’ (Fig. 31).
Fig. 30Vertical Projection of character ‘6’
Fig. 31Vertical Projection of character ‘9’
Page | 36
SNAPSHOTS
Page | 37
1. Loading car image
2. Grayscale image with noise
3. Noise removed
Page | 38
4.Binarization performed
5. Edges detetcted.
6.Plate region detected
Page | 39
7.Noise removed
8.Numbered region extracted
9.Charateres are recognized
Page | 40
FINAL OUTPUT:
10.Final result
RESULT:
Text characters are recognized and displayed to the user using word pad.
Page | 41
EXPERIMENTAL RESULTS
& IMPROVEMENTS
Page | 42
IMAGE ACQUISATION:
Photos with higher resolution (1024 * 768 pixels) are better than lower resolution (640 *
480 pixels).
Photos taken nearer are better than photos taken farer. Since photos taken farer are
dimmer, so they have more dark areas on the license plates which produce noise.
Improvement:
Apply Histogram Equalization to the image. It can spread out the pixel intensities so as to
cover a larger range and produce a higher contrast image.
CHARACTER ISOLATION:
Scaling will distort the characters, so it will lower the accuracy.
Single line license plate is better than double line license plate. It is because the top and
bottom set of characters may not be segmented rightly.
Improvement:
Rotate the license plate so as to make it parallel to the horizon.
CHARACTER RECOGNITION:
In higher resolution pictures the accuracy is 88% if Template Matching algorithm is
used.
Page | 43
CONCLUSION:
Our project combines many methods to extract the license plate, segment the
characters and identify the characters. Further improvement should focus on not only the
accuracy of identification, but also the accuracy of license plate extraction, character
segmentation and standardization.
A program coding with MatLab goes through all the stages of the license plate recognition is
built. It is helpful to understand the procedures of license plate recognition step by step.
They are image acquisition, plate extraction, character segmentation and character
recognition. We have successfully demonstrated the Vehicle Number Plate Segmentation