License Plate Recognition-rivet Removal

Source: Internet
Author: User

In License Plate Recognition, the effect of each step directly affects the overall recognition rate, which interferes with license plate recognition, not only the stains of license plates, but also the rivet.

I. Example: Incorrect License Plate Recognition due to rivet interference

1. vehicle images

2. Confirm the approximate location of the license plate through the color HSV


3. image capturing of license plates


4. horizontal projection after binarization. The rivet is clearly displayed in the image.



5. Character-separated license plate



6. Extract separated license plate characters



7. Error identification results



Ii. Improvement Methods

Here, the interference removal method for License Plate Recognition is improved.

1. In the previous blog post, we used the projection method to remove the rivet from the plate recognition. Rough calculation of the number of white points on the top of the plate number. The number of white points in each row is calculated using horizontal projection.

However, when the rivet is embedded in the middle of the character, interference still cannot be removed.

2. Directly remove the rivet,

1) First, try to separate the character from the rivet Link

2) calculate the number of hops per line. The Rows where one rivet is located are two times, no more than three times. The rows in the character area are more than seven times.

The method used here is to globally search for white points in the rows with the number of hops less than 5, and then calculate its width and height. If the width is greater than 15 pixels, if the height is greater than 25 pixels (the character size after license plate normalization is 20X40), it is not a rivet. Otherwise, it will be deleted as a rivet.

Global traversal code:

For (I = 0; I  height/3; I ++) {if (PointChg [I] & PointChg [I] <5) // Number of hops per row {for (j = 0; j  width; j ++) {if (dst [I * img-> width + j]> = 200 & flag1 = 0) // when a white point is found, it traverses {x1 = x2 = j; y1 = y2 = I; delRivet (img, dst, & flag, j, I, & x1, & y1, & x2, & y2, 15, 25 ); // display8 (* img, dst, 0, 0); flag1 = 1 ;} if (dst [I * img-> width + j] = 0 & flag1 = 1) {flag1 = 0 ;}} break ;}}
Delete the rivet Function

Img: used to record the width and height of the license plate.

Dst: the license plate information after binarization, that is, the space for finding the rivet needs to be traversed.

* Flag: used to identify whether the rivet is used

* X1, * x2 is used to calculate the rivet width * x2-* x1;

* Y1, * y2 same as above

Xlength, ylength, set the rivet width and height threshold.

static int direction[4][2]={{1, 0}, {-1, 0}, {0, 1}, {0, -1}};int delRivet(Bmp1 *img, byte *dst, int *flag, int x, int y, int *x1, int *y1, int *x2, int *y2, int xlength, int ylength){int i;int tmp;int x0, y0;tmp = dst[y * img->width + x];if((*x2 - *x1 > xlength) || (*y2 - *y1) > ylength){*flag = 1;return 0;}dst[y * img->width + x] = 0;for(i = 0; i < 4; i++){x0 = x + direction[i][0];y0 = y + direction[i][1];if(x0 > 0 && x0 < img->width && y0 > 0 && y0 < img->height && dst[y0 * img->width + x0] && (*flag == 0)){if(*x1 > x0)*x1 = x0;else if(*x2 < x0)*x2 = x0;if(*y1 > y0)*y1 = y0;else if(*y2 < y0)*y2 = y0;delRivet(img, dst, flag, x0, y0, x1, y1, x2, y2, xlength, ylength);//display8(*img, dst, 0, 0);}}if(*flag){dst[y * img->width + x] = tmp;}return 0;}

3) plate for removing Rivets


4) Correct Segmentation


5) correctly extract characters



6) correct identification results




The source code will be provided later. I will continue to optimize the license plate recognition code to improve the recognition rate and apply it to the arm platform as soon as possible.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.