You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
The purpose of this project is to develop software that allows the detection ofEuropean single-row license plate without using any external libraries (only pure data processing).The following requirements have been imposed on the project:
The input and output formats for the programs should be PPM or PGM images.
The code should be in C without using any external libraries.
Running program on a Raspberry Pi 3 board.
Software used
GCC 9.2.0 to compile the project
IrfanViev to preview images in PPM format.
Notepad++ with the Hexeditor plugin to edit binary files.
Algorithms used
The following algorithms were used:
Convert the image to grayscale by extracting the average of the R G B components,
Histogram normalization
Binarization of the image with the Otsu method, and with a fixed threshold value,
3x3 image convolution
Edge detection using Sobel operator,
Repeated dilation,
Blob detection
Method of operation
The input of the program is an image in ppm format. Such an image can be obtained on the Internet, reduced to a 512x512 size, and converted to ppm format. It is important to remove any comments in the ppm header section, which some online converters add.
The first step is to create a grayscale copy of this photo.This is achieved by extracting the average value of the R G Bcomponents of one pixel. This image is then savedunder the name grayscaled.ppm.
Once this is done, we normalize the histogram, and binarize our image. At first, we used theOtsu algorithm, but during testing it turned out that the rigid treshold showed better results. The image after binarization is saved astresholded.pgm
After binarization, we move to edge detection using the Sobel operator (both vertical and horizontal edges). The resulting image is saved as edge.pgm.
Next, we perform dilation of the image. We repeat this step several timesso that the detected edges form a cluster of white pixels. In ourtests the number of repetitions turned out to be at least 6. The image afterdilation is saved as dialeted.pgm.
The last stage is the detection of the so-called blobs, and cuttingthe area of interest. This stage consists of calculating the distancebetween white pixels and the previously found clusters. If theirdistance is smaller than the given treshold (empirically set to 94 pixels), the pixelis added to the previously found blob. After examiningthe whole area, we are looking for such a blob, which by its proportionsresembles a license plate (4.5 lengths to 1 height). We crop this area and save the licence plate. This stage is the most sensitive to interference, so itsefficiency is exposed to oversights resulting from previoussteps. The localized array is saved as crop.pgm.
Ideas for development
The change that needs most work is the edge detection. Thesobel operator works well, but the question arises whether using decanny algorithm for this purpose would not be a better solution. Due to the fairly goodresults, the first version of the project remains with the Sabel operator.Another area for improvement is blob detection. A potentially bettersolution can be implemented to detect closed areas and thenfilter it based on its size, position and aspect ratio. Due tocomplexity of the algorithm for detecting such areas (Connected ComponentLabeling), it was left to blob detection.
About
Program that detects licnce plates on photo, and saves them as .pgm file