php method to crack the verification code: 1. Binarize the content of the verification code image; 2. Denoise and remove interfering points; 3. Cut out the string and separate adjacent pieces 1. Cut it out to form characters; 4. Cut the strings pasted together; 5. String recognition.
[Related learning recommendations: php programming (video)]
1. Change the verification code image Binarize the content, that is, set the pixels occupied by the characters or obvious lines inside to 1, and set the background to 0, roughly distinguishing the blanks and characters
2. Denoising, removing interfering points, mainly The purpose is to remove the 1 that is isolated within the 0. The author actually uses a for loop to only determine whether the four points above, below, left, and right are 0.
Sometimes the noise may be continuous 1. The php code for judgment is as follows
3. Cut out the string , cut out the adjacent pieces 1 to form characters;
4. Cut the strings pasted to each other;
5. String recognition (This should require a relatively large library to support it, and store all the graphic samples of character rotation and distortion)
Related learning recommendations: Programming video
The above is the detailed content of How to crack verification code in php. For more information, please follow other related articles on the PHP Chinese website!