An Effective and Fast Iranian License Plate Detection Using Statistical and Geometrical Approaches

The first step in the process of detection a license plate is to determine the location of the plate. The output of this stage should be accurate enough and calculations will be completed within a short time. The reason for this is that the output of this stage is as input in the next steps. If the step to determine the location is encountered error, then the operation of the next steps will also be interrupted. In this paper, a new method is used to improve the contrast of the image, delete non-numeric characters, analysis and clustering of plain characters in order to determine the location of an Iranian car license plate with dark characters, a clear background is provided. The proposed method reduces the overall complexity of the algorithm and in addition to its ease of implementation, the system’s speed and efficiency improve the location of the plate. The proposed algorithm is independent of the number of vehicle plates in the image, image size, complete unread plate and in contrast to brightness variations, it is largely resistant. The results of the test on two different data sets with 67 and 492 images, to an accuracy of 100 and 99.59 percent with an error rate of 1.5 and 1.63 and the runtime of 109 and 17.5 milliseconds averaged, were achieved.


INTRODUCTION
Today, with the rapid increase in population growth and increasing number of vehicles, automatic identification and detection of vehicles seems necessary.Car number plate is a unique identifier that is used in the authentication of the vehicle.Automatic license plate recognition systems are mechanized systems that use image processing on static images or video footage taken by one of the colorful, black -white, and infrared cameras, to play an important role in applications such as the implementation of smart parking lots, counting the number of cars, monitoring of car speed, traffic monitoring, traffic monitoring, and so on.The process of License Plate Recognition (LPR) is mainly composed of three general steps: 1-Determining the location of the license plate, 2-Separation of characters, 3-plate characters recognition.Determining the location of the license plate is one of the most important and most challenging steps in this process.If at this stage, the car's license plate location is not acceptable with due accuracy and in a short time.It will increase the total time of the LPR IP system and the ineffectiveness of the other stages of isolation and detection.
Regarding Figure 1, we can classify vehicle license locations in four general categories.Much of the work done in the literature review [3][4][5][6][7][8][9][10][11][12][13][14][15][16] department at least in one part of their work uses edge-based methods, morphological operations, and portrait and landscape image histograms.The second category involves the use of image-based algorithms [6,14,17,19].These methods will examine and analyze repetitive patterns in lighting changes in parts of the vehicle license plate.The third category is based on color-space conversions such as [8,11,15].In these methods, the color features of the license plate areas are examined and analyzed in the HSV or HSL color space.Finally, the fourth category is the methods 116 presented in [1,20,21] that by examining and analyzing the characters in the license plate, mainly using the CCA tool, the region of the license plate is extracted.
The variation of the appearance of the plates, the non-uniform lighting conditions, the license plate's angle, the camera's distance from the vehicle, the reflection and failure of the light in the imaging process, the low image quality and the timing of the algorithm are among the most important challenges in this field.The above results make sure that there is no definitive solution to license plate recognition [1].Several tasks have been done under limited conditions such as constant lighting, limited car speed, certain paths, and the existence of non-change backgrounds by researchers.In this paper, we tried to reduce the complexity of the algorithm, simplicity of understanding and ease of implementation, the location of the license plate of Iranian automobiles with dark characters on a bright background.we have also been attempting to improve the rate of accuracy while decreasing the positive error rate and increasing the rate of accuracy.
The proposed algorithm is based on statistical and geometric analysis for the license plate location.We examines the results of the tests performed on the two databases provided.\

LITERATURE REVIEW
One of the most common methods in extracting the plate location is using edge detection.In a paper [16], a combined license plate extraction algorithm based on statistical analysis and vertical edge morphology has been used.In paper [16], a hybrid algorithm to license plate detection based on statistical analysis and vertical edge morphology has been used.Paper [15] used a two-stage process of vertical image information of the image as a horizontal frequency representation of the image to determine the candidate regions and then the exact location of the license plate.The paper [13] uses extraction of the edges, determining the candidate areas and using window movement.This method is resistant to rotation, distance and contrast, and can find the location of several license plates in a picture.In [10], at first, it uses a regionbased approach to improve the contrast in places of the image that where a plate may exist to smooth the uniforms and the background.Then, using the Sobel operator and the morphological operation, the place of the plate in the changing climate conditions, distance, brightness and rotation, but there is no way to improve the rotation and precision of the cursor.In [4], in order to expedite the operation, first, the size of the image is considered small, then Gaussian noise reduction filters and histogram homogenization are applied to determine the range of the plate using the representation of the vertical edges and its analysis.In [3], to identify and find out the location, the linear gradient correction and the Sobel operator are used to reveal the vertical edges, and then connect the edges with the appropriate morphological operators.To remove the extra edges, the edge image and the image of the edges connected are subtracted and L1-Norm is calculated.Then the image was bundled with A to so thresholding method and the two-minimum condition of the plain image and at least six peaks and valleys in the histogram of the vertical edges of the plates of Iran for these areas are investigated.Edge detection alone is not used a lot, because many out-of-plates are also detected as an edge.The advantage of this method is its high speed.The use of morphological operations in online systems is not costly due to time consuming.Histogram analysis is not useful for blurry images and images that have been slightly rotated by plates.The Hough transform can be helpful to find lines in order to identify lines with its boundary lines.The problem with this method is the high processing volume and time consuming it [2].
In [17], a text-based method is presented, which uses the review and analysis of the characteristics and patterns of the lighting and color changes in the license plate.One of the most commonly used methods in this area is the use of Haar-like features [6,14,18].However, the articles mentioned above are speeding up the process of identifying plates, but there is a lot of complexity in the implementation and volume of high data for training.In [19], using the alternating variation analysis of lighting, plates areas are identified in a gray image.This method can quickly identify plates in an image with changes in brightness, font, size, and even language.But this approach is somewhat sensitive to spin and perspective.
In paper [15], a color analysis method is used in images that have a color scheme of the car's rear lights to determine the area of the car.Also, in [11], the color space of the HSV, image blocking, region pattern and its evaluation, detected the plate at high speeds.In paper [8], a locally-used color pixel analysis model is used to find the license plate location, which does not have high speeds.In general, although color-based methods can provide a high degree of precision and speed, but they often have more computational complexity than other methods, while they are ineffective in non-color images and are sensitive to noise [2].
Although separation and recognition of license plate characters are two distinct stages in automatic identification of the license plate [20,21], but there are a number of character-based methods that use the tools of these two steps to determine the location of the plate.Generally, the connected components analysis (CCA) is one of the most popular tools in this method which, of course, has challenges such as binary image and noise reduction [2].
In paper [1], using a threshold based on the local average intensity of the pixel brightness, it performs binaries in a window with a pixel m × n on the gray image, then with the modified RANSAC method, examine the binary image attached components to find the best model for the license plate area and the location of the plate is determined by deleting non-character connected binary components, but it may be possible to increase the time and the risk despite the higher binary non-character binary components.
The authors in [22] use the combination of four methods to find the location of the plate.Cascade classification methods with LBP properties, which in each category of the above mentioned are the disadvantages and advantages.This method is sorted hierarchically according to the computational complexity of algorithms based on their chances of success, so that they can reduce their disadvantages while applying their advantage.These methods make the system more reliable, but the response time for each image is predicted to be variable due to the success or failure of each method throughout their hierarchy.Also in general, its computational complexity increases.
Also, in most of the proposed methods, image enhancement is considered as a pre-processing step.Improving image contrast is one of these methods.Due to the focusing of the intensity of the brightness in a specific area of a picture, the image details in that area become overly dense and matched.Using the contrast stretch method can change the brightness of the image, so that the most visible image information can be displayed.Contrast elongation increases the dynamic range of the gray levels in an image.In practice, linear and nonlinear methods have been extensively tested to enhance the contrast of an image.
Linear improvements are very convenient for images with the Gaussian histogram or close to where all brightness values are in a dense range.One of the simplest of them is the minimummaximum linear-line contrast elongation.In this method the values of minimum and maximum brightness levels of a fixed image are determined.Therefore, it does not have the required performance to improve the contrast of the license plates in the images.
Nonlinear improvements, including the similarity of the histogram are often better than linear ones, but have a major weakness.Each value of the input image can have several values in the output image, which causes the brightness correction values associated with the pixels to be lost in an image [24].Figure 2 shows an example of the proposed nonlinear and linear contrasts.

THE PROPOSED METHOD
Because the color feature cannot be robust to color variations due to different lighting conditions throughout the day, different seasons and fragments of parts of the plate like the glow of the color properties that the algorithm depends on and it can also complicate the algorithm, therefore, it uses a gray level image instead.
Contrast elongation is improved as one of the fastest and simplest methods of improving the image contrast in a way that is modified to improve images including license plate; After improving the contrast, for a brief and quick reduction of the image noise used the low-density bit technique (LSB) of the lighting level of each pixel [23].
Binaryization using the integral of the image described below, regardless of the size of the kernel, can make an image binary over time.Also, in this method, instead of removing non-character connected binary components, we try to remove outlier to improve the speed and accuracy of the clause class.
After removing non-numeric binary connected components, a simple and fast algorithm is presented, which analyzes the geometric state of numeric characters in a ROI area to determine the location of plates in the image.In Figure 3, the steps of the proposed method for locating and detection license plates of Iranian vehicles are shown.

Contrast adaptive elongation
Minimal-max linear contrast elongation method described at the end of the literature review section is calculated from Eq (1): [f(x, y) -min] / (max -min) × 255 (1) In this equation g(x, y) is the output image and f(x, y) the input image, min and max the minimum and maximum amount of brightness of the input image and the maximum light level that can be attributed to a pixel in a gray-level image is 255.
In this paper by using Eq. ( 1) and determining the appropriate values of min and max, an adaptive linear contrast improvement method is presented.The equation ( 2) applies to the histogram of the input image of a middle filter to remove the noise and the smoothness.Then the appropriate values for min.and max.then determined by using Eq. ( 3) and ( 4 That h i is the histogram value or the gray levels of the image.For each value of the histogram, the median value is calculated at a distance of 3. To calculate min.and max., in order scroll left to If these peaks are not available, the experimental values 76 and 128 are considered respectively.In Figure 4, using the method described above, the proper estimation of the input domain to the histogram output domain in order to increase the dynamic range of the gray levels is made for Figure 2a.

Real-time adaptive binarization by using the image integral
The method [25] is a simple, fast, and efficient way to binarize image.First, the integral image of the input image is computed and in the next step, the average of a window s×s is calculated using the image integral for each pixel in a constant time and then the comparison is done.If the current pixel value is t percent less than this average, then the maximum value for that is considered, otherwise, the maximum value is considered.

Remove non-numerical components
After analyzing the connected components in the binary image, we use the support vector machine to remove the non-number class from this set of components.This is done by learning the two-class support vector machine using the length-to-width ratio, the distance between the horizontal and vertical sides, the horizontal and vertical alignment, and the frequency of the horizontal and vertical edges of the components, similar to the work done in papers [1,5,8,9,13].To extract the mentioned features, each component is divided into two longitudinal sections and three transverse sections, a total of five pieces.Some of the training data components is shown in Figure 5.

Determining ROI of the plate by using clustering of components
A clustering method is proposed for determining the potential location of a plate with approach the connection between the components of the plate.The standard dimensions of Iranian car plates are 20.5 inches long and 4.5 inches wide or 521 in 111.5 mm [26].Therefore, the approximate length of the plate width at a horizontal angle in the image is about 5 times.An example of the Iranian plate is shown in Figure 6.
According to this notice, it is possible to determine the length of these types of plates from its width.Therefore, the possible range to search for an ROI, as shown in Figure 8, will be possible for each custom component of the components obtained from the previous step.A square area of about L in the middle of the left side of this square is surrounded by the center of a current component as a vegetative area, and the following constraints are taken to obtain the central points of the components within the square as a cluster containing the license plate components: 1.The central point of each component within this square is considered in a cluster.

If the width difference of any component with
a component width of choice is greater than the value of T, then this cluster will be removed.3. The intervals of points from the centers of components to the selected component are removed from this cluster if they are greater than the length of L.

The central points of the components with an
angle greater than θ than the center point of the selected component are removed from this cluster.

The number of remaining components in this
cluster should be between k1 and k2.
The value of L is the length of the plate, which is obtained according to the width of a current component.The value of T is the maximum value of the difference in width between the two components obtained from equal (5).
The value of α is an arbitrary constant coefficient for the width of the selected component h, which is experimentally 0.3 and the value of θ that is the angle between the central point of a selected component with the components of the central component is considered to be 60°.The values of k1 and k2 are arbitrary constants that are empirically considered respectively 2 and 16.
In this step, from the central points of the components, a list of segments is created relative to the central point of the selected component.Then, the segment is selected with the least distances from all the central points of the components of this cluster.Components with their central points relative to this segment less than d, which are between k3 and k4, are accepted as a cluster including a license plate.The values of d, k3 and k4 are considered experimentally 25, 2 and 10, respectively.Finally, the components of this accepted cluster are removed from the list of components, and the clustering steps are repeated for the remaining components until the whole list is processed.In general, the scrolling of this list includes components, from left to right and from top to bottom.In Figure 7, it presenting the flowchart of looking for favorite areas method or ROIs of the license plate it has been shown that C is a set of numerically connected components.β(C) apply the constraints listed above on the set C. The set S contains the possible components of a ROI.Line segment l with the least distance to all the central points of the set of components S and D(s) shows the central distance of each member of the set S.
An example of clustering or determining the ROI range on the extracted components is shown in Figure 9.

Extract ROI and Rotate Correction
Using the information of each cluster, including the location, length and width of the components of the license plate and the angle of the line segment obtained from the horizon can specify the area of each plate in the image.Aware that each car plate with respect to Figure 6 has eight components along each other, we use the relation (6) to extract the ROI.Then the extracted area is rotated in the direction of the angle of the line segment obtained from section 6-3 to correct the car's revision of the license plate.
The values of x1 and y1 are the coordinates of the upper left corner, the values of x2 and y2, the coordinates of the bottom right corner of an ROI and Miss width determine the probable missing length.

Vertical projection to locate the license plate
Although in segmentation it is possible to separate the characters of the region of an ROI but in order to further process the precision of the image can be improved.Then with using Vertical projection and morphological operations similar to paper [15], in the exact location area, the longitudinal plane of the license plate was obtained.
In Figure 11, a more precise location along the longitudinal direction is a typical ROI in Figure 10 (b), using these methods.

EVALUATION OF PROPOSED METHOD
The efficiency of the proposed method is evaluated on two totally different data sets.The first data set-1 collection contains 67 images featuring a variety of car plates in brightness variations, resolution (from 247 to 308 by 1024 by 1280 pixels) rotation (less than 30 degrees) and bit depth (8 and 24 bit) that 24 samples for the training phase are considered in the section on the removal of non-numerical binary components and the rest are for testing.Part of this set is shown in Figure 12.
The second set of data-2 contains 492 images including license plates of 320×40 pixels in length and width respectively, 8-bit color depth, brief rotation and in a day from August 5 to 11 hours before midday was taken that 192 images are considered for the training phase in the nonnumber binary component removal section and the rest are for testing.Part of this set is shown in Figure 13.
For training non-numeric characters, 2000, and for data numbers of 1484 pieces, data sets 1 and 2 were used.From Data 1 and 2, totally less than 40% of the data were randomly se-   lected as training data that about 95 percent of the accuracy of this machine was achieved using these data.The proposed method using C #. NET and image processing and Accord.NET machine learning [27] have been implemented and tested on a standard PC with 2.17 GHz Intel Core 2 Duo CPU and 4 GB RAM.
In Table 1, the results of the evaluation of the performance of the proposed method for locating the license plate in two sets of data in the number of correct diagnosis (TP), nondetection (TN), false detection (FP), duplicate detection (DU), total error rate (Error) and accuracy (Accuracy).This evaluation shows that the minimum accuracy rate in both sets of test data is about 99%, while the maximum total error rate is less than 2.5%.
Table 2 shows the average complexity of time in analyzing connected components (CCA), Gray level filters, Contrast adaptive elongation, adaptive binarization, Component clustering and also remove outlier.As seen in the data set 1, which has a large variety, the average time complexity is 101 ms and for the data set 2 with a low variation of 18 ms.Due to these results and typical hardware specifications in the .NET platform, this proposed method is suitable for fast processing applications.
An example of extracting license plate images using the proposed method in a two-button image in the user interface program is significant.As shown in this picture, car plates are intentionally tampered with and damaged, still, the location of the plates is still detectable with the suggested method.

CONCLUSIONS
The location is one of the main steps in the LPR process.In this paper, a method for the location of the plate was proposed based on the remove outlier in images containing Iranian license plate, analysis and clustering of these components.This method can be located the image of input with different sizes, changes in brightness, rotation, tilting, and, to a degree, plagiarism in the image.The modified Contrast adaptive elongation technique was used to improve the input image.It has also been attempting to reduce the complexity of algorithms in each step by using simple and faster methods and improve speed and accuracy.
According to the evaluations carried out on two sets of data with a small but varied number, acceptable results were presented.In the first data set, which has a variety of different situations, with 24 data as training and 43 test data, the 100% accuracy rate, the error rate was 0 and 2.3%, with a mean time of 117 and 101 ms.Also, in the second data set with a small variety but more, 192 data as training and 300 test data, respectively, the accuracy rate is 100 and 99.33%, the error rate is 0.52 and 2.34%, with a mean time of 17 and 18 ms.
The proposed method is limited to Iranian plates, which have a clear background to the characters.As future work, using the same proposed method and only reversing the image after the binary stage, it is possible to identify plates with a darker background than the characters.Due to the fact that processing is independent of these two types of plates, it can be considered together as a parallel flow to simultaneously detect both types of plates in the same image.

Fig. 2 .
Fig. 2. (A) Main picture, (B) Similarity of the histogram, (C) The proposed adaptive linear method with their histogram

Fig. 5 . 2 Fig. 6 .
Fig. 5. Two left and right columns, respectively numerical and non-numeric data from data sets 1 and 2

Fig. 7 .Fig. 8 .Fig. 9 .
Fig. 7.The flowchart defines ROIs in the set of connected components of an image

Fig. 10 .Fig. 11 .Fig. 12 .
Fig. 10.(a) extract, (b) Rotate correction of a sample ROI (in order to comply with privacy, part of the plate has been hidden)

Fig. 14 .
Fig. 14.An example of two plates found, along with the rotational correction in an image at the original size that have been artificially c damaged

Table 1 .
Performance of the proposed plate detection algorithm

Table 2 .
Computation time of the proposed plate detection algorithm