This article comes from a simple license plate recognition system that I spent 2 days ago. The project, the time is too tight, the sample is also limited, can not reach the request of the other 95% recognition rate (mainly for the license plate, d,0,o,i,1, etc. too similar.) Then, the recognition of Chinese characters is not very difficult, so it has not been accepted by the other party. In this release, at the same time describe the idea and algorithm.
The full text is divided into two parts, the first part is about license plate recognition and common authentication code this kind of common method of recognition, the second part is about similar to QQ authentication code, gmail verification code This kind of abnormal authentication code identification method and thinking.
The common method of license plate/verification Code recognition
The common method of identification of license plate and verification code is:
(1) Grayscale and two value of the image
(2) denoising, and then cutting into a character of one
(3) Extracting characteristics of each character, generating feature vectors or feature matrices
(4) Classification and learning. The characteristic vector or characteristic matrix is compared with the sample database, and the similar sample is selected, and the value of such sample is used as the output result.
The following code describes the process. Because the update SVN Server, I used to BDB stored code can not access, so some of the code is compiled with reflector, I hope to forgive.
(1) Image grayscale and two-valued
The aim is to turn each pixel of the picture into 0 or 255 so that it can be computed. At the same time, part of the noise can also be removed.
The image of the grayscale and two-valued premise is BMP pictures, if not, you need to first convert to BMP pictures.
Speak in code, my code to grayscale the image (the algorithm is found on the Internet):
1 protected static color Gray (color c)
2 {
3 int rgb = Convert.ToInt32 (double) ((0.3 * C.R) + (0.59 * C.G)) + (0.11 * c.b)));
4 return Color.FromArgb (RGB, RGB, RGB);
5}
6