Character cutting in license plate recognition

Source: Internet
Author: User
Tags split
Some of the contents are as follows:
4.3 The improvement method in this paper
Through the introduction of the above two methods, it can be seen that the horizontal projection method for the only connected characters and no interference in the license plate has a good segmentation effect, and the complexity of the algorithm is relatively simple, but for the inclusion of non-connected or sticky characters in the case of a certain difficulty; Template matching method based on the characteristics of the license plate to establish a matching template, a good solution to the character adhesion and non-connectivity problems, but the shortage is due to the need to establish a template beforehand, the complexity of the algorithm is relatively high. In view of the shortcomings of the two methods, an adaptive selection method based on vertical projection is proposed in this paper. This method increases the vertical projection processing method before the character segmentation so that the system chooses the current optimal algorithm as the segmentation algorithm according to the actual situation.
China's standard license plate has the following two characteristics:
1. The license plate contains 7 characters, and the width of the other characters is approximately the same except for "1" and "I";
2. All characters except "Shaanxi", "Chuan" and other few non-connected characters, the others are connected throughout.
According to the above two characteristics of the license plate, in this paper, before the division, the license plate to the vertical projection, because the license plate contains 7 characters, therefore, the ideal case will be formed after the projection of 7 peaks. In this case, the horizontal projection method is used to get the accurate result. However, if there are non-connected characters in the license plate, such as "Shaanxi", "Chuan" and so on, the number of peaks after projection will be greater than 7, obviously, the effect of template matching method is far better than the horizontal projection method. The adaptive algorithm used in this paper is to select the peak number and width of the projection as the threshold value, which improves the accuracy of the segmentation and the efficiency of the algorithm. The flowchart of the license plate segmentation algorithm is shown in Figure 4-2.

4.3.1-Character Segmentation process
The specific flow of the license plate segmentation algorithm is as follows:
1. After the positioning of the license plate binary, complete removal of the left and right borders and separators and other pretreatment process;
2. After the processing of the vertical projection of the license plate, if the number of peaks is 7, and then calculate the peak-to-width ratio of each peak, if within the limits of the threshold, the use of horizontal projection method, or template matching method, the specific code flow is as follows:

Among them, Num is the number of peaks, T1 and T2 for the peak-to-width ratio of the selected closed range, this paper according to the actual license plate character proportion of the selected, NUM is the number of peaks, double and woodlands for the peak-to-width ratio selected closed value range, this paper based on the actual
License plate character Proportional selection [0.8,1.5] as a parameter, width for the record each peak width of the array, F1 () for the horizontal projection method function entry, F2 () is the template matching method function entrance.
3. Extract the segmented license plate characters.
4.3.2 License plate Binary Value
The image obtained by license plate location is grayscale image, but the character segmentation algorithm is based on two value image. Therefore, before the segmentation, the image should be binary processing. The binary algorithm is also called the aperture value algorithm, so the key of the binary value is the selection of the closed value. The Otsu algorithm [2 division] is used in this paper. The Otsu algorithm is deduced based on the discriminant least squares method. The basic idea is to take a closed value T, the image pixels are divided into gray size greater than or equal to T and less than T two classes of C1 and C2, then the two-class pixel mean variance heart (inter-class variance) and two classes of the respective mean variance (intra-class variance), to find the two variance ratio of the largest cut off from value T, the interpretation of the value of the image is the best closed
The total number of pixels in the set class C1 and C2 is City and Gong, and the average gray values of the two classes are M1 and M1 respectively. Then there are:

Oisu algorithm based on the gray value classification of image pixels, according to the principle of inter-class variance and intra-class variance ratio to obtain the threshold value, so that the variance between the target and background is the largest, that is to find the maximum two variance ratio of the closed value, this method regardless of the image histogram has no obvious Shuangfeng, can get more satisfactory results. The main advantages of the Otsu two value-based algorithm are:
1) The implementation of the algorithm is simple;
2) integral rather than local characteristics based on the overall characteristics of the image
3) can be extended to the multi-closed value of the segmentation method;
4) The applicability of the algorithm is strong.
The results of the binary license plate image are shown in Figure 413 (b).


4.3.3 removal of license plate frame
Because the location of the license plate positioning is not particularly accurate, then the siding of the license plate and the rivet will produce noise on the character segmentation, in order to segmentation accuracy need to remove the rivet and license plate frame before splitting. In this paper, the license plate location of the previous step is achieved by calculating the number of peak-valley interactions in the horizontal direction, and the upper and lower border of the license plate is not equipped with this feature, so the positioning of the image is already removed from the upper and lower border after the license plate, so that the work of the character segmentation reduced. So, we just need to remove the left and right border of the license plate.


In this paper, we use vertical projection to count the number of white pixels to remove the left and right border. First, the license plate image to do a vertical projection, as shown in Figure 414 (a), the curve is recorded in the position of the white pixels, you can see the border and the character portion of the performance as a crest. However, for the license plate, the first character is a Chinese character, there will not be a very small width of the peak, then the projection to the left of the first large crest area may be a border, similarly, this article from the back of 1/3 to search backwards, if found similar to the left side of the case, it is considered to be the right border. As discussed above, this article mainly follows the following two conditions when removing the left and right borders:
1. The crest value is large but the width is small;
2. The crest appears on the boundary of all vertical projections.
According to the above conditions, the plate removal frame after the projection image is Figure 41 (b), the corresponding license plate image is 414 (e).
4.3.4 removing separators
A delimiter is a dot between the second character and the third character, and when the binary is projected vertically, it also produces a small crest that needs to be removed before it is split, or it may introduce noise and reduce accuracy.
License plate in a narrow delimiter, the resulting crest is relatively small, according to the above two characteristics, the removal of the license plate separator is:
(1) The peaks generated by the vertical projection are scanned, and the peaks with smaller peaks are marked;
(2) Calculate the width of the marked Crest and calculate the position of the remainder of the entire license plate length, if the position happens to be approximately 1/4 of the entire license plate, the crest is considered a delimiter and set to 0 values. Figure 415 (b) removes the license plate image after the separator.

4.3.5-Character Segmentation
After some processing of character segmentation, the system begins to partition the license plate. Because China's license plate image has a total of 7 characters, in addition to the individual left and right structure of Chinese characters (such as "Shaanxi, Sichuan" and so on), the license plate is projected vertically, will show 7 major peaks, and the width of a single character is roughly the same. Therefore, the adaptive peak number threshold is 7, and the closed value of the peak-to-width ratio is [0.8,1.5"].
4.3.5.1 Horizontal Projection Segmentation method
The horizontal projection segmentation method is simply based on the beginning and ending position of the crest to define the character, and its algorithm is described as follows:
(1) The image is scanned from left to right, the first white pixel is encountered, the starting position of the character is considered, and the record position is begin1,j+1;
(2) Continue to scan, encountered in column J has a white pixel point, the j+l column white pixel point is 0, is considered to be the end position of the character, record position end1;
(3) Repeat (1) of the process, record the start position of the second character begin2, and calculate the second character with the first character of the IB] septum space1=begin2-end1;
(4) Repeat the process of the above (1) and (2) until the end of the scan.
In this paper, the number of crest after vertical projection is 7, and the width of each peak is within the defined range, so the horizontal projection method is the current optimal algorithm, and the system adaptively chooses the method as the segmentation algorithm. The license plate character of the horizontal projection division is shown in Figure 416.

4.3.5.2 Template Matching Character segmentation method
As mentioned in the previous section, if the license plate area is projected to have exactly 7 peaks, then the horizontal projection method can be used to segment, but in the actual environment, some characters have adhesion or non-connectivity phenomena (such as "Shaanxi, Sichuan", etc.), after vertical projection, the resulting peak number does not meet the requirements of horizontal projection. In this case, the system switches to the template matching method for segmentation by creating a standard template to complete the segmentation of the characters before splitting.
The method of template matching is as follows:
(1) If the peaks between the adjacent troughs I and i+1 are small, the gas is removed. Mainly relative to the noise between the characters set;
(2) If the peaks between the adjacent trough I and i+1 are large, even if the distance between I and i+1 is not enough for single character width, because there is "1" in the license plate, it can not be merged and need to be set to mark;
(3) If the adjacent rectangle ' 11 and the width of the bow are small and the combined width is close to the median of the rectangular sequence, the ri-1 and RI are combined to solve the problem of the non-connectivity of some Chinese characters.
(4) If the width of the rectangle ri is close to twice times the median width and the width of the adjacent rectangle is close to the median width, the RI is divided into two parts to solve the adhesion problem in the license plate character.
(5) When the width of adjacent rectangle ri-1 and RI is large and the width is close to twice times the median width, the right boundary of the ri-1 and the left edge of RI are adjusted so that it is as close as possible to the true boundary of the character. In the license plate image, there is a certain approximate gap between the characters and the characters in order to precisely locate the left and right border of the rectangle box.
As shown in Figure 417 (a) of the license plate is the "Chuan" word, and "Chuan" is a non-connected character, in the projection will form three narrow width of the peak, in practice, the need for merging processing. In addition, the character "R" in the license plate and the character "9" there is a adhesion between the projection will produce a wide peak, need to do the split processing.

In this paper, the algorithm based on template matching method is described as follows:
(1) scan the vertical projection sequence to find all the non-0 sequence R in the vertical projection:
R=[1 2 ... 57 77 ... 90 91 ... 210 211 212 213"
(2) Make a difference to R, namely R1 (i) =r (i+1)-R (i), get R1 (i):
r1=[1,1,...,4,1,...,20,1, ... (+)
(3) Find the sequence number vector R2 with step size greater than 1 in R1. Make R2=find (r1>1), get:
r2=[7,12,18, 44, 94,119,142]
Here R (R2 (j)) is the terminating sequence number of the character, and the corresponding R (r (j-1) +1) is the starting sequence number of the character;
(4) calculates the starting and ending serial number num for each peak based on the projected sequence number vector:
Num=[1, 7, I 1,15,18, 23, 32, 57, 77,126,134,158,164,186,192, 213]

(5) Calculates the width of a sequence of widths for each peak according to Num:
WIDTH=[7,5,6,26,50,25,23,22]
(6) based on the obtained width, the average width of the peak is calculated using Ave=sum (width)/7, the Ave is approximately equal to 23, and then the peak is segmented and combined using this average width. In the width vector, width[1]+width[2]+width is approximately equal to Ave, so it may be a non-connected character, while Width[5] is approximately equal to 2*av. , it is likely that character adhesion. The width vectors are combined and segmented according to the characteristics of the judging and license plate characters, and the result is shown in Figure 418.



(7) In accordance with the above method of segmentation and merging, the final sequence range is num ', that is, the final matching template. The split result is shown in Figure 419.
Num ' =[1, 23, 32, 57, 77,101,101,126,134,158,164,186,192, 213]

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.