Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Program that detects licnce plates on photo, and saves them as .pgm file

License

NotificationsYou must be signed in to change notification settings

manczakw/licence_plate_detection_image_processing

Repository files navigation

PC

Compile with:

gcc main.c -o main

Run with:

main FILENAME.ppm

RaspberryPI:

Compile with:

sudo gcc main.c -o main -lm

Run with:

./main FILENAME.ppm

Introduction

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:

  1. Convert the image to grayscale by extracting the average of the R G B components,
  2. Histogram normalization
  3. Binarization of the image with the Otsu method, and with a fixed threshold value,
  4. 3x3 image convolution
  5. Edge detection using Sobel operator,
  6. Repeated dilation,
  7. 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.

in

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.

gray

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

bin

After binarization, we move to edge detection using the Sobel operator (both vertical and horizontal edges). The resulting image is saved as edge.pgm.

sobel

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.

dial

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.

crop

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

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp