IHJPAS. 36(1)2023 130 This work is licensed under a Creative Commons Attribution 4.0 International License Automatic Detection and Recognition of Car Plates Based on Cascade Classifier . Abstract The study consists of video clips of all cars parked in the selected area. The studied camera height is1.5 m, and the video clips are 18video clips. Images are extracted from the video clip to be used for training data for the cascade method. Cascade classification is used to detect license plates after the training step. Viola-jones algorithm was applied to the output of the cascade data for camera height (1.5m). The accuracy was calculated for all data with different weather conditions and local time recoding in two ways. The first used the detection of the car plate based on the video clip, and the accuracy was 100%. The second is using the clipped images stored in the positive file, based on the training file (XML file), where the accuracy was 99.8%. Keywords: cascade classifier, Viola-Jones, training file, positive file and car plate detection. 1.Introduction The increase in the vehicle's number on the roads is due to the increasingly rapid growth in the global economy. This increase has led to the need for security and control of vehicles by constantly monitoring and checking traffic to avoid/control congestion, high speeds, and illegal vehicular activities [1]. There are dedicated camera systems to track stolen cars or search for suspicious vehicles involved in crime on the road to save human energy and material resources. Although this has a very high-resolution rate, these systems cannot operate efficiently based on the recorded videos. This is due to many factors that affect detection performance in various environmental conditions, including Speed, focus, lighting conditions, defects in the panel, noise, and significant traffic volume[2]. This process requires a tedious task of a manual search. Cameras are used on the street, namely traffic, to reduce hazardous traffic jams, accidents, and responsibility. The image processing technology only identifies vehicles by their license plates [3]. Because every vehicle has a unique license plate, no external cards, tags, or transmitters must be recognized by a license plate. Car License Plate Recognition (LPR) is vital in modern life and is doi.org/10.30526/36.1.2895 Article history: Received 19 June 2022, Accepted 7 Augest 2022, Published in January 2023. Ibn Al-Haitham Journal for Pure and Applied Sciences Journal homepage: jih.uobaghdad.edu.iq Noor M. Hashem Department of Phesics,College of Education for Pure Sciences, Ibn Al - Haitham, University of Baghdad, Baghdad, Iraq. noormuayad576@gmail.com Heba Kh. Abbas Department of Phesics,College of Education for Pure Sciences, Ibn Al - Haitham, University of Baghdad, Baghdad, Iraq. hbphysics82@gmail.com https://creativecommons.org/licenses/by/4.0/ mailto:noormuayad576@gmail.com mailto:noormuayad576@gmail.com mailto:hbphysics82@gmail.com mailto:hbphysics82@gmail.com IHJPAS. 36(1)2023 131 considered one of the regulations in different countries. PR technique helps achieve the work, save time, reduce cost, and provide high accuracy. It is applicable in many resources, such as in the control systems of private garages and state institutions, in providing information for security men or searching for stolen cars [4]. Many previous studies focused on identifying and detecting car plates, GhassanKh. A. (2018)[5]. Design a system that can recognize the numbers of "new plates in Iraq" that depends mainly on image recognition according to the following sequence: taking a picture of the car, then locating the plate, then the process of determining the numbers and type of the "special car," carry ... etc. and the province in which the car is located, by applying the template matching algorithm to identify the plate image slices with all possibilities such as Arabic, Hindi, English and Arabic letters in addition to Arabic words in the form database. More than 30 photos were examined. It proved that the system designers have better than 88% recognition rates. Ahmed M. S. et al. (2019)[6] used the Viola-Jones algorithm to detect and recognize Bengali license plates. The method successfully detects multiple license plates on different vehicles with an overall accuracy of 93%. In (2020), Ibtissam Sl. et al. [7] proposed a simple and efficient method to tackle the issue of license plate detection and character recognition. The license plate is detected first based on the two-dimensional wavelet transform to extract the vertical edges of the input image. The high density of vertical edges is computed first to see the potential areas of the license plate. The experiments were done on vehicles that carry Moroccan license plates and showed high accuracy. The results obtained go up to 99.43% in terms of localization and 98.9% in terms of recognition. Besides, the proposed method's efficiency and high accuracy of the proposed method were proved by performing a comparison with other works from the literature on different datasets. Tae-Gu Kim et al. (2021) [8] used closed-circuit television (CCTV) data to recognize car license plates depending on deep learning model training. Unfortunately, this model has a disadvantage with recognition in terms of low resolution and false results with tilted car license plates. Moreover, the CCTV images have a low-quality resolution and details. The authors presented a super-resolution generative adversarial network (SRGAN) model and the perspective distortion correction algorithm to overcome these problems. The output accuracy of their work was tested by the character recognition algorithm YOLO v2. The recognition accuracy rate was 8.8%. Zahid et al. presented a study of Automatic License Plate Detection. They used the R-CNN algorithm and robust License Plate Localization Module to segment colors in HSV images. The output results show an accuracy of 99.1% [9]. The motivation for this work came from the COVID-19 pandemic. According to the World Health Organization protocol, keeping a distance and reducing interaction between people is essential. This led to computerize resources instead of a human controlling everything, like online shopping, payment, booking, and parking. This work uses a digital camera to capture the car license plate height (1.5meter). The car's rotation (tilted license plate) and various weather conditions and noise are considered within the recognition process. Four algorithms were used. The first algorithm was to crop the image frame to select the car license plate. The second algorithm was to label the cropped image, algorithm three was used for the training data set, and algorithm four was used to detect and recognize plates based on the Viola-Jones algorithm. The detection process started with different distances until the accuracy reached 100% based video clip, and the accuracy reached 99.8% based crop image in (positive file). The accuracy depends on the ratio of the detected license plates each second to the total number of license plates in the video clip. The accuracy depends on the ratio of the number of frames seen on license plates detected with the total number of frames of license plates in a positive file. 2.Theoretical Concept Viola-Jones’ object-detection work is a machine-learning method for object-detection proposed by Paul Viola and Michael Jones in 2001. The framework can be trained to detect almost any object, but this essentially solves the problem of a real-time face or license plate detection. The IHJPAS. 36(1)2023 132 algorithm has four steps. They are Haar feature selection, integrated image creation, Adaboost training, and cascading classifier. Haar’s features are similar to convolutional masks, which have many shapes Figure(1) [10]. The difference in the sum of the features of the two rectangles gives the value of these features because they contain the same set of data. At the same time, the sum results from the component of the three rectangles in the middle. This data is used as input into the AdaBoost algorithm. The AdaBoost algorithm is one of the steps of machine learning to detect an object within an image [11]. The data weighting value converts the rating from weak in other methods to strong in this method. A cascade filter is important because it combines all the features professionally. The uninterested region and the region of interest are recognized after each region is sequenced depending on robust classifiers [12]. Figure 1.Viola-Jones features The edge features are the fundamental Haar’s features in different directions. In contrast, line and center features are related to the Viola-Jones features, designed to speed up the output algorithm. All feature size is 24x24 pixels in a standard size to detect objects within an image [12, 13]. The output of Haar’s feature resulted from subtracting the sum values in white and black squares. Pixel new = ∑ 𝑑𝑎𝑟𝑘 𝑝𝑖𝑥𝑒𝑙 𝑑𝑎𝑟𝑘 𝑝𝑖𝑥𝑒𝑙𝑠 − ∑ 𝑤ℎ𝑖𝑡𝑒 𝑝𝑖𝑥𝑒𝑙 𝑤ℎ𝑖𝑡𝑒 𝑝𝑖𝑥𝑙𝑒𝑠 (1)https://doi.org/10.1016/j.gltp.2021.08.044[13] Ada Boost algorithm carries out Haar’s features and classifier training simultaneously, and the meaning of AdaBoost explained by Ada is adaptive and Boost from Boosting. It is an iterative process and trains multi-classifiers by a training set to assemble robust classifiers from weak classifiers. This algorithm was used to eliminate unnecessary data and as training sets. The threshold value was used to determine the eigenvalue of the data set if it is a solid or weak classifier and then to choose an appropriate threshold value [14]. 3.License Plate Detection Algorithm The main purpose of this study is to design an intelligent optical system to identify and distinguish Iraqi car license plates, which are found in more than one design, and to detect the car plate in the parking lot of the University of Baghdad, College of Science for women. The study involved recording videos of all the cars parked in the selected area. The height of the studied camera is 1.5 m, as shown in Figure(2). Images are extracted from the video for use in the training data. The HAAR rating is used to detect license plates after the training step. The Viola-jones algorithm was applied to output the Haar data for each camera height (1.5 m). Calculated accuracy of all data https://doi.org/10.1016/j.gltp.2021.08.044 IHJPAS. 36(1)2023 133 with different weather conditions and local time recording. The car's rotation (the license plate is tilted), weather conditions, and noise are considered in the recognition process. The practical benefit is to have short data that can be saved easily, does not require high storage capacity, costs little, and serves security issues. The impetus for this work came from the COVID-19 pandemic. According to WHO protocol, it is important to maintain distance and reduce interaction between people. This resulted in computer resources being used instead of humans to control everything, such as online shopping, payment, reservation, and parking. The study included some algorithms that were programmed and developed using MATLAB (R2020a) language, as follows: Figure 2. The cartoon shows the suggested method to record the car license plate. Algorithm I Extraction of the area in which we clearly distinguish the number for accuracy in determining. The cropping process is applied to the studied image to eliminate unwanted data. This process removes some details from a vision leading to a change in the aspect ratio, or isolates any object from the surrounding. Algorithm II Image labeler labels images for computer vision applications, Define rectangular regions of interest (ROI) labels, polyline ROI labels, pixel ROI labels, polygon ROI labels, and scene labels. Use these labels to interactively label your ground truth data. Input: Video clips Output: No. of frames cut out for the length of the video Start algorithm  Read the video with the extension (vd.mov) Using the Matlab function (vedio reader) where Read video files.  Calculate the length of the video(lv)  Determining one of the frames for a crop to work for, so that the other frames are deducted based on the measurements of the selected frame using matlab function imcrop creates an interactive image cropping tool associated with the image displayed in the current figure, called the target image. The Crop Image tool is a moveable, resizable rectangle that you can position over the image and perform the crop operation interactively using the mouse.  Store the divided frames in a special folder using the instructionimwrite End algorithm Input: The frames obtained from the application of the algorithm Output: A file with the extension MATLAB that contains all the input frames and delimited the region of interest Start algorithm  Image datastore for image data where An Image Datastore object manages a collection of image files, where each individual image fits in memory, but the entire collection of images does not necessarily fit. To create an Image Data store object, use either the image Data store function or the data store function. Once the object is created, you can specify Image Datastore properties using dot notation and use functions that access and manage the data.  imageLabelerLabel ground truth in a collection of images, where image Labeler Label ground truth in a collection of images.  Save a file in MATLAB format(plat.mat) End algorithm 1.5m IHJPAS. 36(1)2023 134 Algorithm III Create training data for an object detector and Train cascade object detector model. Algorithm IV Detecting and recognition plates based on a Viola –Jones algorithm Algorithm IV Car plate detection using Cascade Classifier technique based on Viola Jones. 4.Result and Discussion 1. This study used MATLAB (R2020a 64bit) to build and develop the proposed algorithms. In contrast, the imaging system records video clips of the car numbers in the parking area at the University of Baghdad / College of Science for Women. 2. Nikon camera D610 [12] is used, shown in Figure 3, which has a 24.3MP full-frame, 6 frames per second continuous shooting, and a 2,016-pixel rgbttl metering sensor. Figure 3. Camera Nikon used in collecting data The proposed system used at different road junctions is as follows: Cropping and Labeling Car Plates: Create a positive file for video clips consisting of 1000 frames, according to the length of the video. Each frame contains the license plate of the captured video clip according to the algorithm (I). Algorithm (II) is applied to make a selection (labeling) of the frames stored in the positive file and stored in the MATLAB file, as shown in Figure (4a). Training Data by Algorithm (III) includes data for a label file containing all frames stored in Input: positive folder contains frames from videos, Negative folder contains different images and labeling file (plat.mat) Output: training cascade file in XML format (plat.xml) Start algorithm  Load positive folder and label file(plat.mat)  Create training data for an object detector, using matlab function objectDetectorTrainingData(gTruth)  Load Negative folder and Datastore for image data  trainCascadeObjectDetector(outputXMLFilename,positivefolder,negativefolder) writes a trained cascade detector XML file named, outputXMLFilename. The file name must include an XML extension. For a more detailed explanation on how this function works, refer to Train a Cascade Object Detector.  Save a file in MATLAB format(plat.xml) End algorithm Input: Video clips Output: The frames through which the plate is determined and appear in the form of a green box the size of the car plate(TARGET), or NO TARGET then determination of accuracy Start algorithm  Detect objects using the Viola-Jones algorithm, the cascade object detector uses the Viola-Jones algorithm to detect car’s plate, using matlab function vision.CascadeObjectDetector('plat.xml')  Load video clip and load positive folder and read frames then make crop for each frame and imresize image According to the distance of the car  Determine manually threshold and size plat  Detected plates in the bounding box in the images are extracted and recognized  Print result for (TARGET or NOTARGET)  Calculate accuracy equal ratio between no. of detect plate on total no. video *100% End algorithm file:///C:/Program%20Files/MATLAB/R2017b/help/vision/ref/traincascadeobjectdetector.html%23inputarg_outputXMLFilename file:///C:/Program%20Files/MATLAB/R2017b/help/vision/ref/traincascadeobjectdetector.html%23inputarg_positiveInstances file:///C:/Program%20Files/MATLAB/R2017b/help/vision/ref/traincascadeobjectdetector.html%23inputarg_negativeImages file:///C:/Program%20Files/MATLAB/R2017b/help/vision/ug/train-a-cascade-object-detector.html IHJPAS. 36(1)2023 135 MATLAB extension for each height (four models), and loading a passive file containing 1000 different images to obtain a file of the extension XML, as shown in Figure(4b). (b) Detection and Recognition Car Plate: The car plates were detected and recognized using the Cascade Classifier technique, based on the Viola-Jones algorithm, and its steps are explained in the algorithm (IV). The detection process is applied in two parts. The first part includes detecting the car plate based on the video clip and calculating each second's accuracy factor and detection rate. The second part involves revealing the license plate based on the images in the training file (XML-File). The process of identification and detection was applied to the video clips of the second model, which includes the detection of the new license plate number (German), which was filmed when the camera was at a height (1.5m), as shown in Figure(5) ‘ Figure 5. Detecting and Recognition license plates in the video clips when the height of the camera is (1.5m) The accuracy factor representing the detection of the car plate in each approved video clip was calculated in the approved model: Number of approved videos =18, car plate detection=18 and the Accuracy = (license plate detection/number of approved videos)*100%=100%. Figure 4. Scheme cropping and labeling car plate (a) Cropping and labeling positive file at camera height 1.5m, (b): Training cascade object detector to get a file with an (XML) extension IHJPAS. 36(1)2023 136 The detection ratio was calculated for each captured video in the four models. It represents the ratio between the number of frames in which the license plate was detected to the total number of frames during each second (30 frames per second), as shown in Table (1). The Detection of the Car Plate based on image: License Plate Detection for crop image based on (XML file), applying recognition algorithm (IV), cropping the image, uploading, reading all the crop images, making a particular crop, and manually selecting a threshold, the license plate (target) will be selected or not (There is no target) and The detection accuracy was calculated using the positive file during calculating the number of frames through which the car was detected while it was moving into the garage and its movement changed, The process of identification and detection was applied to the crop images of the second model, which was filmed when the camera was at a height (1.5m), as shown in Table (2). No. of video clip(.mov) Length of video (lv)(sec) No. of frames each sec Detection rate Test detection (True or False) Video B1 291 10 6/10 T Video B2 257 9 4/9 T Video B3 218 8 3/8 T Video B4 417 14 11/14 T Video B5 323 11 6/11 T Video B6 143 5 3/5 T Video B7 422 15 17/15 T Video B8 285 5 3/5 T Video B9 631 22 17/22 T Video B10 347 12 6/12 T Video B11 141 5 4/5 T Video B12 120 4 2/4 T Video B13 274 10 7/10 T Video B14 225 8 4/8 T Video B15 133 5 3/5 T Video B16 216 8 4/8 T Video B17 79 3 2/3 T Video B18 85 3 2/3 T Image seq. Entering car car detection The number of detected frames of the car The license plate of the detected car car color 1 124 White 2 92 White 3 54 Black 4 21 White 5 72 dark gray 6 82 detect +1 no detect Yellow 7 46 Yellow Table 1. Car plate detection ratio for video clips in the second model Table 2. The accuracy of detecting the detected car plates based on the car frames crop during the shooting video when the camera is at a height of 1.5 meter IHJPAS. 36(1)2023 137 In Table (2), we noted that the accuracy of detection using the movement images of the car inside the garage and the difference in its direction, movement, and colors was 99.8% when the camera was at a height of 1.5 meters. 7.Conclusions License plate detection was achieved using the Viola-Jones method based on Cascade Classifier. (18) Cars were examined in the garage of Baghdad University / College of Science for women. The proposed system setting was used with a height of 1.5m, where the detection accuracy appeared based on the video clip was 100%, and the accuracy based on the cropping file and training file was 99.8%. The suggested system is recommended to check the license plate at a short distance or use a high-performance camera. It is recommended to place the camera in the direct direction of the front car so that the detection and discrimination process becomes very effective. The proposed system can work with different car license plates in other countries with different types of numbers or letters, as well as work regardless of the environmental conditions and the difference in lighting. 8 67 White 9 50 White 10 51 Black 11 61detect +1 no detect White 12 71 Red 13 22 White 14 81 White 15 101 White 16 3 Black Total 16 1000 998 998 Accuracy 998/1000= 99.8% IHJPAS. 36(1)2023 138 References 1.SHASHIRANGANA, J.; PADMASIRI, H.; MEEDENIYA, D.; PERERA, C.; Automated license plat recognition: a survey on methods and techniques. IEEE Access 9:11203-11225. DOI:10.1109/ACCESS.2020.3047929 2. Adarsh, P; Rathi, P; Kumar, M.; Yolo v3- tiny: Object detection and recognition using one stage improved model. Conference: 2020 6th International Conference on Advanced Computing and Communication Systems, ICACCS. 202, 687–694. 3. Albiol, A.; Sanchis, L.; Mossi, J. M.; Detection of Parked Vehicles Using Spatiotemporal Maps, IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS, 2011, 12, 4. 4. Krizhevsky, A.; Sutskever, I.; Hinton, G. E.; Image Net classification with deep convolutional neural networks. NIPS'12: Proceedings of the 25th International Conference on Neural Information Processing Systems, 2012,1097–1105. 5.Ali, G. K.; Developing Recognition System for New Iraqi License Plate, Tikrit Journal of Engineering Sciences. 2018, 25, 1, 7 – 10. 6. Saleque, A. M.; Chowdhury, F. S.; Md. Ashraf Khan, R.; Kabir, R.; AKM. Bahalul, H.; Bengali License Plate Detection using Viola-Jones Algorithm. International Journal of Innovative Technology and Exploring Engineering (IJITEE) ISSN. 2019, 9, 2, 2278-3075. 7.Ibtissam, S.; Wahban, A.; Issam, A.; Abdel l. H.; An automated license plate detection and recognition system based on wavelet decomposition and CNN, journal homepage:www.elsevier.com/journals/array/2590-0056/open-access-journal, 2020, 8,100040. 8.Tae-Gu, K.; Byoung-Ju ,Y.; Tae-Hun, K.; Jae-Young, L.; Kil-Houm, P.;Yoosoo, J.; Hyun, D. K.; Recognition of Vehicle License Plates Based on Image Processing, MDPI,2021;Appl. Sci. , 11,14, 6292. 9.Mahmood, Z.; Khurram K.; Khan U.; Syed H.; Adil, S. S.A.; and Mohsin S.; Towards Automatic License Plate Detection; Sensors . 2022, 22, 3, 1245. https:// doi.org/10.3390/ s2203 1245. 10. Hermawati, F. A.; Koesdijarto, R.; A Real Time License Plate Detection for Parking Access. Telkomnika: Indonesian Journal of Electrical Engineering, 2010, 8, 2, 97-106 11. Chen, Y. N.; Han, C. C.; Ho1, G. F.; Fan, K. C.; Facial/License Plate Detection Using a Two- level Cascade Classifier and a Single Convolutional Feature Map. International Journal of Advanced Robotic Systems, Int J Adv Robot Syst, 2015. 12:183 | doi: 10.5772/61477. 12. Hrvoje, R.; Petra, G.; License plate detection for preserving privacy using Haar classifiers, Faculty of Organization and Informatics , Central European Conference on Information and Intelligent Systems.2015, 153 -157. 13. Shetty, B.; Bhoomika, A.; Rebeiro, D.; Ramyashree, J.; Facial recognition using Haar cascade and LBP classifiers. Global Transitions Proceedings, 2021, 2, 2, 330-335. 14. Zhao, Y.; Jing, G.; Liu C.; Han, S.; Gao, Y.; Qingmao, H.; License Plate Location Based on Haar-like Cascade Classifiers and Edges, Second WRI Global Congress on Intelligent Systems, 2010, 978-0-7695-4304-8/10 $26.00 © 2010 IEEE, DOI 10.1109/GCIS.2010.55. https://www.researchgate.net/journal/IEEE-Access-2169-3536 http://dx.doi.org/10.1109/ACCESS.2020.3047929 https://dl.acm.org/doi/proceedings/10.5555/2999134 https://dl.acm.org/doi/proceedings/10.5555/2999134 https://www.sciencedirect.com/science/article/pii/S2590005620300254#! https://www.sciencedirect.com/science/article/pii/S2590005620300254#! https://www.sciencedirect.com/science/article/pii/S2590005620300254#! https://www.sciencedirect.com/science/article/pii/S2590005620300254#! https://sciprofiles.com/profile/494769 https://sciprofiles.com/profile/484940 https://sciprofiles.com/profile/author/MERCeUx0VVpETkRpV1ViQVh3NlppaVJWMjhGT2RMV0oxV3lSVEJDMTE1ND0= https://sciprofiles.com/profile/author/Mm9RUWx3K29OUTBIOGtrMlM0RE51elR0T1F0RFBmMHdheDRHdC9vMGhjRT0= https://sciprofiles.com/profile/author/SWRWQ1FYMzErRk9MR2prbHVtNzdyMVc5YkptVTJFb3hleVFTNDBqZUUxOD0= https://sciprofiles.com/profile/author/SWRWQ1FYMzErRk9MR2prbHVtNzdyMVc5YkptVTJFb3hleVFTNDBqZUUxOD0= https://sciprofiles.com/profile/769040 https://sciprofiles.com/profile/769040 https://www.sciencedirect.com/science/article/pii/S2666285X21000728?via%3Dihub#! https://www.sciencedirect.com/science/article/pii/S2666285X21000728?via%3Dihub#! https://www.sciencedirect.com/science/article/pii/S2666285X21000728?via%3Dihub#! https://www.sciencedirect.com/science/article/pii/S2666285X21000728?via%3Dihub#! https://www.sciencedirect.com/science/article/pii/S2666285X21000728?via%3Dihub#! https://www.sciencedirect.com/journal/global-transitions-proceedings https://www.sciencedirect.com/journal/global-transitions-proceedings/vol/2/issue/2 9.Mahmood, Z.; Khurram K.; Khan U.; Syed H.; Adil, S. S.A.; and Mohsin S.; Towards Automatic License Plate Detection; Sensors . 2022, 22, 3, 1245. https:// doi.org/10.3390/ s2203 1245. 10. Hermawati, F. A.; Koesdijarto, R.; A Real Time License Plate Detection for Parking Access. Telkomnika: Indonesian Journal of Electrical Engineering, 2010, 8, 2, 97-106 13. Shetty, B.; Bhoomika, A.; Rebeiro, D.; Ramyashree, J.; Facial recognition using Haar cascade and LBP classifiers. Global Transitions Proceedings, 2021, 2, 2, 330-335. 14. Zhao, Y.; Jing, G.; Liu C.; Han, S.; Gao, Y.; Qingmao, H.; License Plate Location Based on Haar-like Cascade Classifiers and Edges, Second WRI Global Congress on Intelligent Systems, 2010, 978-0-7695-4304-8/10 $26.00 © 2010 IEEE, DOI 10.1109...