The fifth chapter uses the SVM and the neural network the license plate recognition

Source: Internet
Author: User
Tags reflection svm alphanumeric characters
the fifth chapter uses the SVM and the neural network the license plate recognitionTags: license plate recognition 2014-03-13 21:23 1115 people Read reviews (0) Favorite report Category: Images (42)

Directory (?) [+]

"Original: http://blog.csdn.net/raby_gyl/article/details/11617875"

Title: "Mastering OpenCV with practical computer Vision Projects"


because added a * number, display garbled, do not know how to do, in order not to delay everyone see can download word version of the translation : http://download.csdn.net/detail/xuluhui123/6806749

inevitably wrong, not in this article modified, in case garbled again, here, but the code is not Chinese comments, Word version has.


translation of some other chaptersin the book: http://blog.csdn.net/raby_gyl/article/details/17472271

e-Book Download address: http://download.csdn.net/detail/xuluhui123/6310819

Download the source code with the book address: http://download.csdn.net/detail/xuluhui123/6310851

Program Flowchart Download Address: http://download.csdn.net/detail/xuluhui123/6310811

Flowchart can also be consulted: http://blog.csdn.net/xuluhui123/article/details/11659915

Recommendation: Use SVM and neural network license plate recognition detailed flowchart, and part of the code explanation : http://blog.csdn.net/raby_gyl/article/details/11659915

I am English level four, the following translation only for their own archive and like me as a beginner to see. There are a lot of mistakes, there are many English sentences I don't quite understand. Please correct them. I'm going to have a good digestion lately. will also be modified. Recently just read the OPENCV Chinese version of the machine learning, OPENCV the characteristics of the data are already done, for the generation of feature data, the operation of the matrix is not familiar with me, or in the brain difficult to form a whole idea. Want to download some examples of project code on the Internet, it seems difficult, even if found and no detailed instructions, for a beginner may take a long time to fully clear (also must consult the relevant information). Recently fortunate in the OpenCV forum, see friends recommend this book, and with the source code, can run, see the effect. This made me decide to have a look, for a do not like to see English, I have to bite the bullet to read the fifth chapter. The biggest pain in reading English is the long sentence, the modification of the back and forth, however, the second great pain is that we remember not very good, read a paragraph, even if every sentence seems to understand, but what will be or foggy. In fact, I feel the best way, is that I understand, translation down, the whole into Chinese, and then the elaboration is not semantically reasonable.

< content >

This chapter introduces you to the steps required to create an automatic license plate recognition application (ANPR). Depending on the situation, there are different methods and techniques. For example, IR camera (infrared cameras), fixed car position, light condition, etc. We started building a ANPR application to detect the license plate in a 2-3-meter-away photo. In the dim light, and not parallel to the ground but with a small angle of the license plate tilt.

The main purpose of this chapter is to introduce the image segmentation and feature extraction, the basis of pattern recognition, and two important pattern recognition algorithms: Support vector machine and artificial neural network. In this chapter, we will include the following:

1, ANPR (Automatic license plate recognition)

2. License plate Detection

3. License Plate Recognition


ANPR Introduction:

ANRP, known as ALPR, or AVI, or CPR, is a method of monitoring and other methods, such as segmentation and detection, used in optical character recognition to read a vehicle's grade.

The best result in the ANPR system is the use of an infrared camera, since the segmentation steps before the detection and OCR (Optical character recognition) segmentation are simple, clean, and error minimized. This is due to the principle of light, most fundamentally because the incident angle is equal to the reflection angle. When we look at a smooth surface such as a flat mirror, we can see this basic reflection. Reflections of rough surfaces such as a sheet of paper are referred to as diffuse or scattering. The main part of the car's grade has a special feature called back reflection. The surface of the license plate

It is made of materials that cover thousands of small hemispheres. This causes the ray to bounce back to the source of light, as we can see from the following figure:


Angular reflection scattering or diffuse back reflection

If we use a camera with an infra-red projection structure and a filter, we re-acquire it with an infrared camera, and we get a very high-quality photo to split and subsequently detect and identify the license plate number. That is, it is not dependent on any lighting environment, as shown in the following figure:

In this chapter, we do not use infrared camera, we use regular camera. We do this so that we do not get the best results and get a higher level of detection errors and high error recognition rates. This is the opposite of what we expect with infrared cameras. However, the steps are the same.

Each country's license plate size and specifications are different, in order to obtain better results and reduce errors, we know that these specifications are like Blake useful. The algorithm used in this chapter is intended to illustrate the fundamentals of ANPR and Spanish license plates, but we can extend them to any country or spec plate.

In this chapter, I will use the Spanish license plate. In Spain, there are three different sizes and shapes of license plates. We will use the most common (most used) license plate, the size of which is 520*110mm. The spacing between the two characters (numbers and letters) is 41mm. The distance between numbers and numbers before (or between letters and letters) is 14mm. The first set of characters contains four digits. The other group contains three letters, which do not include vowel letters: a,e,i,o,u. and N,q. All character sizes are 45*77.

This data is important for character segmentation because we can check two characters and spaces to verify that we get a character and no other part of the picture. Here is a license plate map.



ANPR Algorithm

Before interpreting the ANPR code, we need to define the main steps and tasks of the algorithm. ANPR is divided into two main steps: License plate detection and license plate recognition. License plate detection is the detection of license plate in the entire image frame position. When a license plate is detected in an image, the partition of the license plate is given to the next step-the license plate recognition. In the license plate recognition, we use the OCR algorithm to determine the number of alphanumeric characters on the license plate.

In the figure below we can see the steps of two main algorithms, license plate detection and license plate recognition. After the license plate recognition, the program will draw the detected license plate in the image frame. The algorithm can return bad results without even a result (undetectable).


Each step is shown in the diagram above, and we define another three steps. They are often used in pattern recognition algorithms.

1, split. This step detects and moves each area of interest in the image.

2, feature extraction. This step extracts a series of features for each block.

3, classification. This step from the license plate recognition step or the image is divided into a license plate and no license plate detection of the steps, (the two steps above) to extract each character.

The following diagram shows us the steps of pattern recognition throughout the algorithm.

Aside from the main application, where the purpose of the application is to detect and identify a license plate number, let's briefly describe two tasks that are not often introduced:

1, how to train a pattern recognition system.

2, how to evaluate such a system.

However, these tasks are often more important than the main application itself. Because, if we can't properly train the pattern recognition system, our system will fail and not work correctly. Different patterns require different types of training and evaluation. We need to evaluate our systems in different environments, conditions, and features to get the best results. These two tasks are sometimes used together because different characteristics can produce different results, which we see in the Evaluation section.


License plate Detection


In this step, we need to detect all the license plates in an image frame. In order to do this task. We are divided into two main steps: Split and split classification. The feature step is not elaborated because we use the image part as a feature vector.

The first step (split), we apply different filters, morphological operations, contour algorithms, and confirm that obtaining images of these parts may have a license plate.

The second Step (classification), we use support vector machine (SVM) to classify each part of the image-our characteristics. Before creating the main program, we trained two different categories--license plates and no license plates. We use the forward _ horizontal Vision color image, the width is 800 pixels, from 2 to 4 meters away from the car obtained. This requirement is important to ensure proper segmentation. If we create a multiscale image algorithm, we can show the detection.

In the image below, we show all the processing that is included in the license plate detection:

1, Sobel Filter

2. Threshold operation

3. Closed operation

4. Mask of filled area

5, the possible detection of the license plate marked red (feature image)

6, after the SVM classification, the detected license plate


Split

Segmentation is the process of dividing an image into many parts. This process simplifies image analysis and makes feature extraction easier.

An important feature of license plate segmentation is the high number of vertical edges in the license plate (which is more vertical edges) (assuming the photo is taken from the front, the license plate is not rotated and there is no visual distortion.) This feature can be used in the first step of the segmentation (Sobel filter) to exclude areas that do not have vertical edges.

Before looking for a vertical edge, we need to convert the color image to grayscale, because the color is not helpful in our task and removes the camera or the noise from the outside. If we do not apply the Denoising method, we will get many vertical edges, which will result in detection failure.   [CPP] view plain copy//convert image to Gray Mat Img_gray;   Cvtcolor (Input,img_gray,cv_bgr2gray); Blur (Img_gray,img_gray,size (5,5));

To find the vertical edge, we use Sobel filtering and find the first-order vertical derivative. This derivative is a mathematical function that allows us to find the vertical edge on the image. The Sobel function in OPENCV is defined as follows:

[CPP] view plain copy void Sobel (Inputarray src,outputarray dst,int ddepth,int xorder,int yoder,int Ksize=3,doub Le scale=1,double delta=0,int bordertype=border_default)

Here, Ddepth is the depth of the destination image, Xorder is the order of the X derivative (that is, the order derivative of x), Yorder is the order of the Y derivative. The size of the ksize nucleus is either 1,3,5 or 7. Scale is used to calculate the pilot value, which is an option. The delta is an optional option that adds to the result. Bordertype is the interpolation method for pixels.

In this procedure, we use xorder=1,yorder=0,ksize=3; [CPP]

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.