Skip to main content
. 2019 Dec 20;20(1):55. doi: 10.3390/s20010055
Algorithm 1: The proposed algorithm
1. Start Video Capture
2. Read Video_Frame
3. Resize Video_Frame
4. Gray_Frame = Transform to grayscale (Video_Frame)
5. Apply filter to remove the noise (Gray_Frame)
6. Frame_Edges = Detect edges (Gray_Frame)
7. Frame_Contours = Find contours (Frame_Edges)
8. Sort (Frame_Contours)
9. Declare Number_Plate_Contour
10. Declare Largest_Rectangle
11. for Contour in Frame_Contours do
12.    Perimeter_Rectangle = Calculate perimeter (Contour)
13.    Approx_Rectangle = Find the approximate rectangle (Perimeter_Rectangle)
14.    if (length (Approx_Rectangle) == 4) then
15.      Number_Plate_Contour = Approx_Rectangle
16.      Largest_Rectangle = Find area (Approx_Rectangle)
17.      break
18. x,y,w,h = Calculate up-right bounding rectangle (Largest_Rectangle)
19. Cropped_Frame = Crop using x,y,w,h (Video_Frame)
20. Draw Largest_Rectangle contours on Video_Frame
21. Transform to grayscale (Cropped_Frame)
22. Frame_Threshold = Binarize (Cropped_Frame)
23. Kernel = New square object of size 1x1
24. Image_Dilation = Dilates using Kernel (Frame_Threshold)
25. Dilated_Image_Contours = Find contours (Image_Dilation)
26. Sorted_Dilated_Contours = Sort (Dilated_Image_Contours)
27. for Dilated_Contour in Sorted_Dilated_Contours
28.    x,y,w,h = Calculate up-right bounding rectangle (Dilated_Contour)
29.    Draw a rectangle of dimensions x,y,w,h on Video_Frame
30. end for
31. Transform to binary (Gray_Frame)
32. License_Plate_Characters = Transform to string (Gray_Frame)
33. if length(License_Plate_Characters) > 0 then
34.    Get License_Plate_Characters
35. end if
36. return Video_Frame