In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how Python recognizes alphanumeric verification codes. I hope you will get something after reading this article. Let's discuss it together.
It is inevitable to encounter CAPTCHA in the process of crawler, and all kinds of CAPTCHA seem to block the pace of crawler.
Because the function of this paper is completed in the intranet environment, there is no code introduction and no recognition effect display.
1. Encode and convert the sample image.
2. Get a code that can reflect the characteristics of the image, and then save the code of all these sample images.
3. The method of converting images into code can choose hash for conversion.
The method of image conversion code the hash conversion process I choose is as follows:
Zoom: the picture is zoomed by 8x8.
Average: calculate the average of all pixels in the grayscale image.
Comparison: the pixel value is greater than the average of 1, otherwise 0, a total of 64 bits.
Generate hash: combine the 1s and zeros generated by the above steps into the fingerprint (hash) of the picture. The order is not fixed. But the comparison must be in the same order.
After obtaining the hash value, the hash value of the same number for the picture is stored in the txt file. In actual use, the hash value of the predicted image is the same as that of the predicted image, and then the hash value of the four predicted images is calculated. The hash value of the test image is compared with the hash in the TXT file, and the hamming distance is calculated, that is, how different the hash value of the two 64 bits is, the less the different digits are, the more similar the picture is.
After obtaining the hamming distance between the test image and the hash value of each sample image, statistics are carried out, and the sample image label with the largest prediction value is taken as the prediction value. The recognition speed is also good, and it takes an average of 0.3 seconds to complete a recognition.
This recognition method is easy to operate and is very effective for simple alphanumeric combined verification codes, but it puts forward higher requirements for image preprocessing and does not have generalization. Different CAPTCHA codes need to be edited separately each time.
After reading this article, I believe you have a certain understanding of "Python how to identify alphanumeric combination CAPTCHA". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.