Libyan Licenses Plate Recognition Using Template Matching Method

License plate recognition (LPR) applies image processing and character recognition technology to identify vehicles by automatically reading their license plates. The work presented in this paper aims to create a computer vision system capable of taking real-time input image from a static camera and identifying the license plate from extracted image. This problem is examined in two stages: First the license plate region detection and extraction from background and plate segmentation to sub-images, and second the character recognition stage. The method used for the license plate region detection is based on the assumption that the license plate area is a high concentration of smaller details, making it a region of high intensity of edges. The Sobel filter and their vertical and horizontal projections are used to identify the plate region. The result of testing this stage was an accuracy of 67.5%. The final stage of the LPR system is optical character recognition (OCR). The method adopted for this stage is based on template matching using correlation. Testing the performance of OCR resulted in an overall recognition rate of 87.76%.


Introduction
License plate recognition (LPR) technology applies image processing techniques to identify vehicles by automatically reading their license plates.Automatic License Plate Recognition systems are usually installed in places of interest for intersection control and traffic monitoring points to identify vehicle that violates traffic laws or to find stolen vehicles.Many techniques are developed for recognition of number plates [1] such as Support Vector Machine (SVM) [2] neural network character recognition [3] [4], pattern or template matching [5] [6] etc. Main goal of this paper is to implement the template matching method presented in the literature [1] [5] [6] and test its performance on Libyan License plate.In addition to the simplicity of this method it is also fast and accurate enough for real time applications.The main motivation for this work is the recent violent events in Libya, since an efficient LPR system may help to reestablish low and order in the country.Also as the Libyan authority is working to redesign their car plate, it is important to consider the LPR requirement to improve the systems performance.An overview of the paper is as follows: In Section 2, the main elements of designed License plate recognition system is discussed and the steps involved in the recognition process are introduced.This includes the first the stage of license plate segmentation and second the OCR algorithm to identify the license digits.In Section 3 a brief description of the data collected for this work is given.The Evaluation results are introduced in Section 4, where first the results of individual stages are given then the overall performance on the Libyan LPR system is stated.In section 5 the results and findings are discussed.Finally, the conclusion and future scope have been offered in Section 6.

System Design
The designed LPR system is divided in to five main stages which are preprocessing stage, License Plate horizontal band acquisition, License Plate area acquisition stage, segmentation, and finally the OCR stage.These stages are illustrated in Figure 1.

Preprocessing
The first step in the system is to converts an RGB image to a gray level image, using the method standard for NTSC images [7] is expressed in following relationship (Equation ( 1)):

( )
Gray Red 299 Green 587 Blue 114 1000 The second step in this stage is he binarization stage.A threshold is used to convert the gray scale image to a binary image.shows an example of a car picture that has been converted to gray scale.In this work the Otsu's method [8] is used to obtain the suitable threshold.Otsu's Thresholding method involves iterating through all the possible threshold values and calculating a measure of spread for the pixel levels each side of the threshold, i.e. the pixels that either falls in foreground or background.The aim is to find the  threshold value where the sum of foreground and back ground spreads is at its minimum.Figure 2(c) shows the result of this method.

Horizontal and Vertical Edge Detection
Typically horizontal and vertical edges are found by convolving the source image with matrices designed to identify the location of high frequency in the image.There are many edges detection methods mentioned in the literature [9].In this work the Sobel edge detection method is adapted [7].The Sobel edge detector uses a pair of 3 × 3 convolution (window) matrices (Gx, Gy) as defined below in (Equation ( 2)).The first Gx is used to detect the vertical edges, while the second Gy detects the horizontal.The periodical convolution of the original image m (x, y) with the Sobel matrixes is used to detect various types of edges in an image.The convolution with Gx is used to identify the horizontal edges Gh (x, y) given by (Equation (3)): ( ) ( ) ( )

Gh x y Gx s t m x s y t
The convolution with Gy is used to identify the vertical edges Gh (x, y) given by (Equation ( 4)): ( ) ( ) ( )

Gv x y Gy s t m x s y t
The magnitude of the affected pixel is then calculated using the formula in (Equation ( 5)): The horizontal edges Gh (x, y) vertical edges Gv (x, y) and the magnitude G (x, y) are shown in

Band Acquisition Phase
This stage of the system is concerned with obtaining the horizontal band of the image where the license plate is located.The technique used in this work assumes that the plate band is located in the horizontal band with the highest concentration of vertical edges.To detect this band horizontal projection of Gy is computed by (Equation ( 6)): where w is the width of the image in "m".The horizontal projection ( ) hp y represents an overall magnitude of the image mapped to the y axis, as shown in Figure 4(a) and Figure 4(b).This is used to define the location of the concentration of vertical edges, resulting in a horizontal band with the same length as the original image but a more specific width for the plate to be in.

Plate Clipping
This stage is concerned with the detection of the exact location of the plate in the horizontal band detected in the previous step.The same assumption is used again in this stage that the plate is the area with the heights concentration of vertical edges.To find this area in the horizontal band the vertical projection is used as illustrated by (Equation ( 7)):    A smoothing filter is applied to smooth the vertical projection to make it easier to identify the required region.Usually a number of areas of high concentration of vertical edges can be found on the horizontal band, however the plate region is assumed to be the longest of these regions, as shown in Figure 5(d).

Segmentation
The automatic number plate recognition accuracy of the designed system depends on the accuracy of the segmentation process.If the segmentation fails, a character can be improperly divided into two pieces, or two characters can be improperly merged together.
The plate is segmented by detecting spaces in the vertical projection of the plate image.An adaptive Thresholding filter is used to enhance an area of the plate before segmentation.The adaptive Thresholding is used to separate dark foreground from light background with non-uniform illumination (Figure 6(a)).The boundaries between segmented characters correspond to dips in the vertical projection as shown in Figure 6(b).
The final part of the segmentation stage is to reduce the size of the segmented image to the smallest box that fits the character and obtaining a normalized size of the final segmented image.This is important to the results of the temple matching stage, since temple matching it not a shift invariant or size invariant process.By reducing the image to the normalized smallest box boundaries the shifting of the characters is limited.Also a normalized size of the final segmented image is used to reduce the effect of the differences in the images size.The final segmented digits are shown in Figure 7.

Optical Character Recognition (OCR)
The last stage of the designed LPR system is the OCR stage.A Template matching technique is used where the character or digit is recognized by comparing the segmented image to the database of pre-prepared template.This involves determining similarities between a given template and the extracted characters.The classification process matches the digit to the template that produces the highest similarity measure.A threshold of the lowest accepted similarity is used to avoid negative classification.For this technique to give acceptable results the correlation between the temples of similar digits needs to be much higher than the correlation of different digits.To test the correlation factor of different characters, 10 random samples are selected from each digit; the lowest coloration for each case is displayed in Table 1.
As expected the correlation between the similar digits are much higher than those of different digits.The lowest of these factors if 0.77 which occurs in the case of the digit 5, this is used as a threshold of the classification process.Also it is clear from the results in Table 1 that the correlation between some different digits is high.As an example the correlation between 6 and 8 is 0.67 which is lower but close to the set threshold.This may cause errors in the classification process.

Data Collection
The work presented in this paper specifically deals with Libyan licenses plates.Different standards for license plates are found all over the world, and variations within each country are usually limited.The system is designed to recognize the Libyan personal car plate type.This can easily be generalized to the other types of car plates in Libya, since the same fonts are used in these plates.The data for this work is collected by manually capturing photos of randomly selected cars in the Benghazi area.Two hundred photos are used to test the designed system.The number of digits in each license varies from six to nine digits.Manual ground truth finding process is used to build a database of all license plate numbers, and associated to its corresponding images.

LPR System Evaluation
The evaluation process is divided to three stages.First is to evaluate the performance of the band detection phase, then the evaluation of the band clipping phase and finally the evaluation of the plate segmentation and recognition phase.Two hundred photos of randomly selected cars are used to evaluate the performance of this system.Only the successful output of one stage is used to evaluate the next stage.
To test the percentage of correct band and plate detection, all two hundred images of the randomly selected cars are introduced to the band/plate detection stage and a manual ground truth is used to detect the correctly extracted bands.From the two hundred images one hundred and thirty five bands were successfully detected, giving a band detection accuracy rate of 67.50%.
For the OCR evaluation, the hundred and thirty five successfully extracted bands were passed to the OCR system.The summery of the OCR performance is illustrated in Table 2.For each digit the number of occurrence and the recognition rate is calculated.The recognition rate ranges from 93.9% in the case of digit 7, and a minimum recognition rate of 54.76% in the case of digit 6.The overall OCR recognition rate is found to be 81.4%.The performance LPR system is evaluated by calculated the number of license plates that are successfully identified.Table 2 illustrates the obtained results.The license plate identification is accepted if the wrongly classified digits are less than two digits.This gives an overall license plate number recognition rate of 52% when calculating the recognition rate of the original two hundred images, while it rises to 62% when calculated over the 135 identified bands.The results of the different recognition rates are illustrated in the last to columns of Table 3. License recognition rate (1) is calculated for the two hundred images, while License recognition rate (2) is calculated for 135 successfully extracted bands.

Discussion of Results
The detection of the plate region is based on the compact details a plate usually contains.Plate detection errors occur in cases where the car image has other areas with high contents of details.As shown Figure 8 the horizontal band extraction by this method miss identify the highly detailed region for the plate horizontal band.This problem may be tackled by introducing further heuristic analysis method that may choose between more than one candidate for the plate region.Another clear source of plate number detection errors is the common us of external screws to fix the license plate on cars.The large screws' heads are randomly placed and frequently put over some of the digits causing the splitting or the merging of some characters.Another source of detection error is the poor maintenance of some of the plates resulting in poor quality and the deformation of some of the digits.

Conclusion and Future Work
In this paper a vehicle's license plate recognition system is presented, the system is tested on Libyan personal vehicle license.The used algorithm implements the template matching method which in addition to its simplicity it is also fast and accurate enough for real time applications.The system architecture has been discussed and identifying the two main steps involved in recognition process.First the identification of the license plate location in the image, second the OCR stage where the digits of the car plate number are individually identified.Experiments that has been carried out, clarifies the proposed system as a potential candidate for Libyan license plate recognition system, and obtaining a normalized size of the final segmented image.This is important to the results of the temple matching stage, since temple matching it not a shift invariant or size invariant process.By reducing the image to the normalized smallest box boundaries the shifting of the characters is limited.Also a normalized size of the final segmented image is used to reduce the effect of the digit 7, and a minimum recognition rate of 54.76% in the case of digit 6.The overall OCR recognition rate is found to be 81.4%.

Figure 3
y represents an overall magnitude of the image mapped to the x axis as shown in Figure5(c).

Table 1 .
Correlation factor of digits templates.

Table 3 .
Evaluation of licenses number recognition.