Automatic License Plate Detection and Recognition for Jordanian Vehicles

Article history: Received: 19 August, 2020 Accepted: 16 November, 2020 Online: 24 November, 2020


Introduction
The system of automatic license plate number detection and recognition, known as ANPR (automatic number-plate recognition), is considered a great application and an example of the computer vision technology. ANPR is widely being used in, but not limited to, radar cameras, car park management and traffic management [1]. In Jordan, ANPR is being used in recording traffic violations (e.g., over-speeding), however it has several problems. In particular, some of the ANPR steps: cropping of the license plate and optical character recognition (OCR) are still being done manually [2]. This might be due to the high cost of a fully customized commercial ANPR system for detecting and recognizing the Jordanian license plates. Therefore, the main goal of this paper is to propose a low cost ANPR system that is customized for automatically detecting and recognizing the numbers of the Jordanian license plates. We aim to reduce and avoid human labor, and the possible human errors. Having human involved ANPR steps might result in misidentifying a vehicle plate numbers and data, which can cause erroneous tickets.
The main contributions of this work are as follows: • Propose a low cost fully automated and customized Jordanian ANPR system.
• Propose and utilize an optimized calculation methodology of the rectangularity metric [3] to efficiently detect the Jordanian license plates.
• Build a database of Jordanian vehicles to be used as a benchmark for evaluating the performance of the proposed system.
• Compare the proposed system to other ANPR systems with the help of the built database for the Jordanian vehicles.
• Incorporate the recognition of the vehicle type and make into the system.
The rest of the paper is organized as follows. Section 2 presents the related work. Section 3 discusses in details the proposed system. Section 4 presents the experimentation results. Section 5 provides a discussion about the proposed system and the obtained results. Section 6 concludes the paper and provides some future work directions.
Generally speaking, any ANPR system consists of four main steps as listed below, which are also shown in Figure 1.  Based on the ANPR steps above, in the literature, several works have been proposed to address and optimize each step. Additionally, there is a significant work in combining the ANPR system with detecting and recognizing the make of the vehicle. In what follows, some of the related work regarding the ANPR systems and the vehicle make recognition systems are briefly presented.
In [4] and [5], the authors proposed an ANPR system, where mean shift segmentation is used to identify candidate plate regions. Then, the authors trained and used a Mahalanobis linear classifier with respect to three features to accurately detect number plate region. Namely, they used rectangularity [3], which is defined by the authors as "a measurement that represents how well an object fits its minimum enclosing rectangle", aspect ratio and edge density features.
In [6], the authors proposed an Iranian ANPR system, where edge detection and morphological operators are used to identify license plate candidate regions. The percentage of rectangularity and color filter of each candidate plate region are used to accurately detect the plate region. Multilayer Perception (MLP) neural network is finally used for recognizing the numbers of the detected plate.
In [7], the authors proposed an Indian ANPR system. License plate detection is based on using Sobel filter edge detector, morphological operations and connected component analysis. The segmentation and recognition of plate characters, which are in different Indian languages, are performed based on training a Support Vector Machine (SVM) classifier.
In [2], the authors proposed a Jordanian ANPR system that is based on SIFT features to detect Jordanian license plates and recognize them. Template matching technique is used to locate special marks in the license plate to segment out the license plate. Finally, OCR is used to recognize the characters or numbers from the segmented plate.
In [8], the authors surveyed several keypoint features under the feature-based automatic license plate detection techniques. They categorized the vehicle detection techniques into motion and appearance based, which included sophisticated probabilistic modeling and feature extraction. Also, the authors surveyed and discussed vehicle recognition utilizing vehicle attributes like license plate, color, type, and logo.
In [9], the authors applied a bag of features method to the car make and model recognition (VMMR). The sparse coding technique based on square mapped gradients (SMG) feature descriptors is used to learn a dictionary of codewords. The authors then apply supervised K-means or SVM with SMG to recognize the car make and model. Finally, the authors compared the performance of the two approaches.
In [10], the authors proposed an automatic license plate recognition system to trap traffic violations. For example, to trap offenders disobeying the traffic rules in an enclosed space (e.g., campus).
In [11], the authors proposed an ANPR-based vehicle tracking system, which monitors vehicle's Euclidean distance from a visible calibration line. License plate detection was based on the fact that license plate has an inherent property of having greater transitions in pixel values compared to that of its surroundings.
In [12], the authors proposed a number plate detection and localization system based on segmentation and morphological operators to segment out license plate from the captured image. Specifically, the authors used histogram checking, and vertical and horizontal edge detection methods for the segmentation of the license plate. The experimentation dataset consisted of 350 license plates from different countries including Jordan. The reported efficiency rate from the proposed system is 93.43%.
In [13], the authors proposed a Jordanian ANPR system, where the license plate was detected and localized based on a multistage algorithm using the aspect ratio and the edges ratio. Back propagation neural network was used for recognizing the license plate characters (OCR). The average success rate from the proposed system is 90% of 240 high resolution images of size 1188 × 960 pixel.
Very recently, in [14], the authors proposed an ANPR system to recognize the Bangladeshi characters in vehicle license plates. Morphological operation and histogram analysis with a dynamic threshold of vertical and horizontal projection profiles were applied in order to detect plate area. Character recognition is carried out using Support Vector Machine (SVM) classifier, where extracted Histogram of Oriented Gradient (HOG) features were used as input. The system was applied to 630 images of Bangla license plates of different categories of vehicles and achieved 91% accuracy in the extraction of plate ROI.
After surveying the literature and to the best of our knowledge, the work of [2,12,13] is the only published work that examines the detection and recognition of the license plates of the Jordanian vehicles. Therefore, the work presented in this paper extends the literature regarding the Jordanian license plates detection and recognition. In fact, the proposed work improves the automatic Jordanian license plate detection and recognition proposed in [2] by using another feature, which considers both the appearance shape of the license (rectangularity and aspect ratio) and the license plate content for detecting the license plate. Furthermore, the recognition of vehicle logo and make was also incorporated. It is worth mentioning the notes concerning the work by authors in [12] and [13]: • The processing time for detecting the license plate and recognizing the plate numbers in both [12] and [13] was not reported at all, whereas in the proposed work it is being reported.
• The dataset of [13] consisted of high resolution images withwww.astesj.com 700 out presenting any sample images. In the proposed work many sample images are provided from the created and employed dataset, which mostly consisted of mid to low resolution images, but better than 320 × 240.
• Neither the work in [12] nor in [13] presented a fully comprehensive ANPR system, where both the license plate type (private, public, government, etc.) and the vehicle's make are being recognized similar to what are being implemented in the proposed work.
Additionally, it is noteworthy to mention that the proposed work shares some similarity with the work presented in [4] and [5]. The proposed system utilizes the rectangularity and aspect ratio metrics in detecting the license plate (Jordanian plate in our case), where it achieved the best plate detection accuracy compared to using the rectangularity methodology proposed in [4] and [5]. This will be discussed in more details in the next section.

Proposed System
This section presents the details of the proposed Jordanian ANPR system. Taking into consideration the main ANPR steps presented in Figure 1, in the designed and implemented ANPR system, the following steps were considered as shown in Figure 2. The system was fully implemented in MATLAB R2018a [15], where the graphical user interface (GUI) is shown in Figure 3.

Input image
The very first step in the system is to capture a vehicle image. An off-the-shelf webcam and a mobile phone camera were used to capture a set of database images to evaluate the system's performance.
Additionally some of the images were obtained from the Jordanian Opensooq website [16]. In general, the captured images should be of good illumination conditions whenever possible, capture either the back or the front of the vehicle, and have a good resolution (e.g., better than 320 x 240). The database consisted of 100 images, which corresponds to different illumination conditions, different backgrounds, and different perspectives of the captured Jordanian vehicles (i.e., angle and distance between the camera and the vehicle location). Figure 4 shows 16 randomly selected input images chosen from the created dataset. Several preprocessing steps are then being performed on each input image that included histogram equalization to help in reducing varying day light effect and for contrast enhancement.

Vehicle detection
The second step is to detect the vehicle from the input image. Faster Regional Convolution Neural Network (FRCNN) [17], which is an objecte detection built-in MATLAB function, was trained to detect and determine the vehicle and its location in the image. FRCNN was chosen since it is significantly faster in training and testing sessions over other detection methods (e.g., R-CNN). Additionally, it is considered as a highly successful framework for generic object detection [18]. The process of using FRCNN is done iteratively among different zooming versions or scales of the input image. This iterative procedure stops, when a vehicle is found or the input image is zoomed to the maximum. In this case (the latter), it may be that no vehicle is found and thus the ANPR system will give an error message indicating such a state and halts. Otherwise (i.e., once the vehicle is found), a blue bounding box around the detected vehicle is drawn. The detected vehicle is then cropped and converted to gray scale. Figure 5 shows an example of this step.

License plate detection
The third step is to detect the license plate from the cropped gray scale vehicle image, which is one of the most important ANPR steps. Initially, the fast marching segmentation method [19] is executed to find the best license plate candidate regions. Precisely, this segmentation method will segment the vehicle image into several connected components or parts. The segmented growing parts are initially initialized based on a uniformly chosen seeds within the cropped vehicle image as shown in Figure 6. One of those parts must be the license plate. Figure 7 shows some of the segmented parts as it was very difficult to visualize all candidate segmented parts for all seeds in the same image; as the segmented parts may overlap and therefore the segments will not clearly be viewed. To accurately identify the correct license plate region or part, the following analysis is performed: • First, the shape of the Jordanian license plate is rectangle with two styles: European and American as shown in Figures 8  and 9, respectively. The European style places the numbers in one row. The American style places the numbers in two rows.
• Next, rectangularity measurement is used [3]- [5] to first identify the segmented parts whose shape is best described by a rectangle, but of certain aspect ratio. This is the aspect ratio, which is computed based on the ration between the height and width of either the American or European styles of the Jordanian license plate. Figure 10 correctly shows identified and detected license plate part based on the rectangularity measurement metric.
• Consequently, a red bounding box is drawn around the part, which satisfies the above constrain or criterion, and crop it as shown in Figure 11.
It is important to emphasize that one of the main contributions in this paper is the methodology used in computing the rectangularity measurement, and thus that for detecting the license plate more efficiently and precisely. Specifically, the presented methodology is quite different and efficient compared to that described in [4], [5] as explained next.   www.astesj.com 702   The methodology for computing the rectangularity in [4], [5] requires that: • each candidate license plate region is to be treated as a rigid object, • computing its area A 0 by counting the total number of pixels in the region, • finding its minimum enclosed rectangle (MER) fitted to its boundary by iteratively rotating this object in one degree steps in the range [−15 • , 15 • ] to account for possible tilted angles of the captured vehicles, • computing the area of MER of this object at each incremental rotation, • identifying the angle at which the MER goes through the minimum value (A MER ), and • finally computing the rectangularity R at this angle as given in 1: However, the methodology does not require rotating each candidate plate region in a range of steps, which we believe is an important step to perform in order to efficiently detect the correct license plate with high confidence. However, performing this step iteratively and incrementally might be very time consuming and might not produce precise rectangularity calculation. Alternatively,the following steps are performed, which constitute one of the main contributions of this work: • Each candidate license plate region or object is checked to make sure it has a convex shape as was proposed in [20]. In case it is not convex, it is converted to a convex shape so that spaces in the outwards lines of the object (if any) are connected and filled. This process uses a set of morphological operation (dilation, followed by filling, and lastly followed by erosion).
• Next, ellipse fitting is applied to each convex shaped object. This helps us determine the major and minor axis's of the fitted ellipse of the object.
• The object is then rotated as to remove the rotation angle, which is the angle between the elongation axis (major axis for the fitted ellipse) and the X-axis. Indeed, this is the angle at which the MER goes through the minimum value (A MER ).
• Then the area A 0 of the rotated object (the total number of pixels in the convex shape) is computed.
• Finally, the rectangularity R using Equation 1 is calculated.

Rectangularity Analysis
The methodology presented in [4], [5] was compared with the proposed methodology. It is important to mention to the best of our knowledge that we could not find any work other than [4], [5] which used the rectangularity metric as a major step in detecting and localizing the license plate similar to what is proposed in this paper. And, since this step is really the most critical step and the heart of any ANPR system, we believe that using the methodology of [4] and [5] as one of the baseline comparisons is still a fair choice especially with the proposed enhancement given in the previous subsection, which we believe shows an advancement to the literature in this direction. In the comparison, the dataset of 100 images is used to compute the detection accuracy of correctly finding the license plate region and the average rectangularity calculation time. The results are presented in Table 1. The results indicate that the proposed rectangularity calculation is more accurate, precise and faster. In fact, the analysis showed that proposed rectnagularity measurement values were very close to one for the candidate license plate objects compared to around 0.7 based on [4], [5]. Additionally, it is worth noting that the rectangularity measurement calculation under different ∆θ's ∈ [−15, . . . , 15] as in [4], [5] might not be unique. The analysis shows that the same rectangularity value can be obtained under multiple different ∆θ's, which can be problematic and result in misidentifying the correct license plate region. www.astesj.com

Jordanian license plate Verification
Upon the detection of a possible license plate region, it remains to verify that it is indeed a Jordanian plate. To do so, the label part is examined. It is located to the left side of the Jordanian license plate as shown in Figure 12. It contains the English and Arabic characters of the word Jordan. Therefore, it was decided to use template matching technique based on computing the score of the cross correlation coefficients between two binary windows; (the binary templates of the Arabic characters of the word Jordan and the binary connected components objects extracted from the anticipated label area of the identified license plate candidate). Following are the performed template matching steps: • converting the label area into the binary scale using Otsu's method.
• segmenting out all possible characters or objects within the label area by performing connected component analysis on them.
• resizing these segmented objects to match the size of the stored binary templates of the Arabic characters of the word Jordan • exhaustively computing the correlation coefficient between each object and the templates.
if the computed correlation coefficients are above heuristically computed threshold, then the detected license plate is declared to be a Jordanian one.
otherwise, it gives an error message that it could not find a Jordanian plate and halts.

Determine license plate type
The fifth step is to determine the type of the Jordanian vehicle. This information is color-coded (see Table 2) in the label area of the license plate. Thus, in the proposed ANPR system, we analyze the color of the detected license plate label area in the original input image. Consequently, based on the analyzed color (most frequently occurred color value) and the recognized code part from the next ANPR step (numbers in first line in American license plate and the digits before the dot in European license plate), we determine the type of the vehicle. Figure 13 shows some examples of the detected Jordanian license plate types from the ANPR system. Table  3 summarizes the types found in the created dataset.

Recognition of license plate numbers (OCR)
The sixth step is to recognize the license plate numbers. First, all possible characters within the detected license plate binary image www.astesj.com 704 are extracted by performing connected component analysis within the plate region. Each extracted connected component or object is resized to match the size of the stored binary templates of the numeric plate numbers (from 0 to 9) that are graphically shown in Figure 15. The typeface used to generate such templates is known as Mandatory [23], which is the same typeface that is used for the United Kingdom vehicle registration plates. Figure 15: The stored binary templates (inverted in order to best be viewed) of the numeric plate numbers that are desired to be recognized (from 0 to 9) Figure 16: More binary templates of the numeric plate numbers that are desired to be recognized (from 0 to 9) Finally, the correlation coefficient between each object and the templates is exhaustively computed to recognize the plate numbers. It is noteworthy to mention that, in order to increase the OCR recognition accuracy, the number of stored binary templates for the character set '0123456789' was increased as shown in Figure 16. This resulted in having better matching of the segmented objects and thus high confidence in the associated recognition results. Additionally, the license plate area that excludes the label region ( Figure 14) is the OCR region of interest because the segmentation of possible numbers or objects is performed in it. As stated above, the Jordanian license plate splits into two different styles: European and American. Thus, the performed connected component analysis considers the properties and characteristics (distribution of the numbers) of the two types. It also considers the following facts: • The width and length of all numbers are the same.
• The distance between numbers is nearly the same, except the code part (numbers in first line in American license plate and the digits before the dot in European license plate), which determines the type of vehicles such as: 50: taxi, 36: private bus, etc.).
• All numbers in the license plate have the same color, which is black. Additionally, the background color for the license plate (except label part) is white.
A green bounding box is drawn around each recognized number in the license plate region as shown in Figure 17. After applying the OCR, the code of the license plate is computed by calculating the distance between all numbers. The code part determines the type of the vehicle as we mentioned before and listed in Table 2.

Recognizing the make of the vehicle
The seventh and final step of the proposed ANPR system is to determine the make of the vehicle. In this step, the make of the vehicle is recognized by localizing and recognizing the vehicle's logo. Generally speaking, the fact that the vehicle's logo is approximately located in the region above the detected license plate can be relied on, which can be a weak assumption. However, in this presented step, it is desirable to prove the concept of being able to add such feature (i.e., recognizing the make of the vehicle) easily. Thus, the vehicle's logo in the segmented parts from the third step is searched for. The segmented parts are just above the detected license plate region. Once a logo was detected, a yellow bounding box is drawn around it. To help recognize those detected logos, several logo images from the Internet were collected. The images were specifically related to five auto makers MERCEDES, MITSUBISHI, KIA, NIS-SAN and TOYOTA. The list could be expanded easily. It should be mentioned that the dataset consisted of 17 vehicle makes or brands as summarized in Table 4, and the recognition focus was just put on five of them as indicated above. After that, using the collected logo dataset, a convolutional neural network (CNN) is trained with the help of MatConvNet MATLAB toolbox to recognize the five makes of the vehicles as listed above. While testing this ANPR step on the input images dataset, it is assumed the case where none of the logo images of the vehicles would match the makes from which the CNN classifier is trained on as an "UNKNOWN MAKE". Figure  18 shows the recognized make for the vehicle that was shown in Figure 10. Figure 18: The recognized make for the vehicle that was shown in Figure 10 To conclude this section, Figure 19 shows and summarizes the output of all stages of the proposed ANPR system. As it is clear from Figure 19: • The detected vehicle is identified by a blue bounding box.
• The detected plate is identified by red bounding box.
• The detected logo of the vehicle is identified by yellow bounding box.
• The detected license plate is a Jordanian one and its type is private; since it has a white color and its code is recognized as "24".
• The recognized license plate numbers are "12692", where each number is bounded by a green bounding box.
• The recognized make of the vehicle is "Mitsubishi".

Experimental results
This section presents the experimental results of the proposed ANPR system. A 100 images were tested as mentioned in the previous section. The average execution time for all tested images was found to be 8.0047 sec on average (ANPR steps 2-6) on a computer machine that has 16 GB of RAM and two quad core 2.5 GHz i7 processor.
The system implementation was purely sequential and thus a single core was utilized. Table 5 presents the results (success rates or accuracies). The reported accuracy for each of the rows in Table 5 was computed for each step separately assuming correct results from previous step. As it can be seen from Table 5, the final license plate recognition accuracy from the OCR step was 94.68%. Consequently, the overall ANPR accuracy is 89% given the fact that the license plate detection step failed in 5 images, the license plate verification step failed in 1 image, and the OCR step failed in 6 images for a total of 11 images out of 100 (this is shown in the last row of Table  5). Finally, the accuracy for recognizing the make of the vehicles was 70.21% as given in the second row of Table 6 with an average execution time of 0.0096 sec. However the actual make accuracy was observed to be 86.84% as shown in the last row of Table 6. We should note that images without valid logos and unclear logos were manually excluded. Therefore, by excluding those images from the make evaluation dataset, the above accuracy was recomputed. We have compared the proposed system with the following ANPR systems: the ANPR system, which is available online at [24] and the ANPR system proposed in [2] (our previous work). For this comparison, we only used the 94 images out of the created dataset for which the license plates were successfully detected and verified as listed in Table 5. The result of this comparison is shown in Table 7, which shows that the proposed system achieved the best performance in terms of the recognition accuracy.
www.astesj.com 706 Figure 19: Summary of the output of all the steps of the proposed ANPR system.

Discussion
As it can be inferred from Table 5, some of the steps need to be optimized either in terms of the average execution time or the accuracy of detection and recognition. For example, the average execution time of the license plate detection step was around 3.6327 sec and it was the largest among the rest of the steps. This is caused by the largest number of candidate segmented regions that were needed to check the license plate for; Rectangularity measurement and aspect ratio. Specifically, this is controlled by the number of the initialized seeds which is equal to 256 = 16 × 16 uniformly spaced grid as was shown in Figure 6. Despite that being said, it is important to highlight that our average calculation time of the rectangularity measurement per each candidate license plate part was better compared to the work of [4], [5] as was shown in Table 1 with a detection accuracy of 95%. Studying the factor of reducing the number of initialized seeds to reduce the license plate detection time is planned as a future work and how would that affect the detection accuracy. Another observation from Table 5 is that the next highest average execution time was the license plate verification step. We believe that this is related to the way in which the verification process was performed as large number of small sized binary segmented windows were exhaustively compared against the binary templates of the English and Arabic characters of the word Jordan. Moreover, we carefully investigated the single failure case from this step, and it turned out to be caused by the bad resolution cropped license plate. The produced binary image of the cropped license plate is as shown in Figure 20.
Additionally, based on the results obtained from the OCR step, it was found that the main causes for the relatively low OCR recognition rate are related to one or more of the following factors: • The numbers on some of license plates were not so much clear in the captured input images or may have bad illumination conditions; such as the example shown in Figure 21.
• Some of the numbers have certain painting defects that cause the OCR algorithm to not recognize them correctly such as the example shown in Figure 22 for the number '6'. www.astesj.com These kind of problems result in a bad segmentation of the plate characters and thus bad input to the OCR algorithm. Therefore, bad OCR recognition results.  Moreover, the lowest recognition accuracy was for the step of recognizing the vehicle's make. This was due to the assumption in localizing the logo of vehicle, which was assumed to always be found in the upper regions above the license plate. We believe that the main challenge was that the location of the logo above the license plate is not indeed consistent among all the vehicles, especially the tested ones (there were too much variations). Therefore, as was mentioned in Section 4 and after analyzing the captured input images, it was found that there were several images without any logo as can be seen in Figure 23, and in some of the images the logo was not clear due to the bad illumination conditions or due to the shadow effect as seen in Figure 24. It turned out that the number of images in the created dataset that possess these kind of problems was found to be 18. As a result of this observation and in order to test the performance of the trained make recognition subsystem, we excluded those 18 images from the make evaluation dataset (94 images). Consequently, the make recognition acucray was observed to be 86.84% as was shown in last row of Table 6.
For the final cost of the proposed ANPR system in terms of the hardware needed to run, it is clear that it only needs a computer machine and a camera to capture input images of the vehicles. Thus, considering the fact that cameras are now almost available everywhere (e.g., mobile phone cameras and surveillance cameras) and that much of the processing needed can be done on the cloud, the estimated cost of the proposed system could be as low as zero. Last but not least, although the proposed Jordanian ANPR system in this paper was shown to provide very good recognition results, however it may not work or produce correct results for all cases of the input images. Indeed it needs to be further analyzed under bad illumination conditions, blurriness in image, dirtiness or painting or physical defects problems in the numbers and characters on the license plate, and under the bad weather conditions (e.g., foggy and rainy conditions). About the speed performance of the proposed system, it is important to emphasis that the estimated time usually depends on the scene complexity of each input image, input image resolution, and the underlying speed of the running machine.

Conclusions and Future Work
The paper proposes a fully automated license plate recognition system targeting the Jordanian license plates as a case of study. The proposed system uses and optimizes the calculation of the rectangularity measurement to better identify the best license plate candidate region, which is considered one of the main contributions of the paper. The proposed Jordanian ANPR system was tested on a database that consisted of 100 Jordanian vehicles and compared it to two ANPR systems from the literature. Consequently, proposed system achieves and reports the best performance among the compared systems in terms of the OCR recognition rate, which was 94.68%. We hope that the presented system will be adopted in the very near future in Jordan.
The presented system still needs to be optimized in different aspects as was discussed in Section 5, which is slated for future work. For example, it is desirable to study the effect of the selected number of seeds during the license plate detection step on license plate detection accuracy and the average detection time. Additionally, it is useful to analyze and further experiment the proposed system under bad illumination and weather conditions, blurriness in image, and under physical defects problems in the numbers and characters of the license plate. Moreover, examining better methods for recognizing the make of the vehicle and increasing the number of trained classes for the recognition of other makes are another area of future work.

Conflict of Interest
The authors declare no conflict of interest.