Moved to the old campus two days, the dorm students are very good, although the small black House is very small, but everyone together feel very comfortable, today in the laboratory to stay a day, feel that time really fast, feel that they still have a lot of not, should be used in the laboratory time to catch up, with the words of the sister-in-school, life or And next to the sister-in-school communication, slowly to learn, not late Europe.
Today's Harvest:
0. There are different ways of dealing with different verification codes, but the method of integration is not
1. Grayscale, that is, for a pair of color pictures, for each pixel, there are r,g,b three components to the respective distribution of the proportion of the harmonic.
RGB color image can be considered to be composed of 3 pairs of monochrome grayscale image, you can directly take any channel in the RGB grayscale image, such as the premise is that the image of the target pixel brightness information is mainly distributed on the B channel, otherwise the gray result will be a large number of luminance information loss. Grayscale images are also called luminance images.
However, to grayscale the color map, there are 4 ways:
1.1 gray=r*0.11+g*0.59+b*0.3
1.2 Gray=max (R,G,B)
1.3 Gray=min (R,G,B)
1.4 Arithmetic Average
2. Median filter, mainly for the salt and pepper noise, with a 3*3 filter window on each pixel sliding, it will each pixel point of gray value set to the point of a neighborhood window of all pixels in the gray value of the median value. Repeat the method 2-3 times, the picture is more stable.
3.RGB, grayscale, black and white, binary graph:
3.1 RGB Chart: Is the life of the color map, each pixel has 24 bits, is R:8bit, G:8bit, B:8bit
3.2 Grayscale: R=g=b=gray of each point, 8 bits per pixel, 256 gray level (2^8)
3.3 Black and White: Just a visual image of a black and white two-color picture;
3.4 Two Value map: is only 1bit per pixel, is two gray level of the graph
4. Verification code identification of the basic method:, binary, median filtering denoising, segmentation, tightening rearrangement (let the height of unity), character matching recognition
5. Picture two summary of the method of value (refer to http://blog.csdn.net/jia20003/article/details/8074627 here)
5.1 This method is very simple, after the RGB color image grayscale, the scanned image of each pixel value, the value of less than 127 to set the pixel value of 0 (black), the value is greater than or equal to 127 of the pixel value is set to 255 (white). The advantage of this method is that the computational volume is small and fast. Disadvantages more first the threshold value is 127 without any reason to explain, followed by completely regardless of the image pixel distribution and pixel value characteristics. It can be said that this method is the most mentally retarded two value processing method is not too too.
5.2 The most common two-value processing method is to calculate the average k of the pixel, each pixel value of the scanned image is set to 255 (white) with a pixel value greater than the K pixel value, and the value is less than or equal to the K pixel value set to 0 (black). Compared with the method one, the threshold selection is a little bit of IQ, can be explained. But using the mean as a binary threshold also has a fatal disadvantage, which can cause some object pixels or background pixels to be lost. The result of binary value cannot reflect the source image information truly.
5.3 Using the Histogram method to find the value of the binary threshold, histogram is an important feature of the image, the histogram method to select the binary threshold value is mainly found in the image of the two highest peaks, and then in the threshold value of two peaks in the Peak valley between the lowest point. This method is a little bit more precise than the previous two methods. The results were also more acceptable.
5.4 Using the approximate one-dimensional means method to find the binary threshold, the approximate steps of this method are as follows: code See links
1. An initialization threshold T, which can be set by itself or generated according to a random method.
2. According to the threshold graph, each pixel data P (n,m) is divided into the object pixel data G1 and the background pixel data G2. (N is
Row, M is column)
3. The average of G1 is M1, and the average of G2 is m2
4. A new threshold t ' = (m1 + m2)/2
5. Back to the second step, continue to divide the pixel data with the new threshold value as the object with the Beijing pixel data, continue to step
Until the new threshold value is calculated equals the last threshold.
6. Some denoising filtering methods: One is the frequency domain, one is the spatial domain
Eg: mean value filter, median filter, Wiener filter, image wavelet domain filter
Reference: Http://wenku.baidu.com/linkurl=9V3jrEyUJJeV6IS_aqM04CkOpD_h27iMA1InhqIEBTKVWbij4g3tbFSPs_ Dvtinj0bf7xzgtqvq8ea9k66sa-zd9stv0asgvrqxzqieqsi3
7. A useful two-value code:
def binarized (picture): Pixels = Picture.load () (Width, Height) = picture.size Threshold = number of # Thresholds For I in Xrange (Width): For J in Xrange (Height): if Pixels[i, j] > Threshold: # Greater than threshold is set to background color, otherwise set to foreground color (text color) P Ixels[i, j] = BACKCOLOR else: pixels[i, j] = TextColor return picture
See http://hereson.iteye.com/blog/2224334 for all methods of the image object in 8.python
9. The simple segmentation method includes equidistant segmentation, integral projection segmentation, intersection segmentation, and connecting area.
Some image array operations in 10.python, refer to Http://www.2cto.com/kf/201601/487884.html
11.python is very focused on indentation, the appearance of unexpected indent is the problem of indentation
There are some common problems to see http://www.oschina.net/question/89964_62779
12. Have a good blog post, continue to study http://drops.wooyun.org/tips/4550 tomorrow
A man must have a dream, but he cannot be defeated by reality. Good night, blog Park.
New life ...