C # Implementation of New Unicom verification code recognition

Source: Internet
Author: User

In the past, I wrote an article about the implementation of automatic recharge for China Unicom recharge cards. Recently, I found that the UNICOM official website has been revised. I casually read the new verification code, which is different from the previous one, I sent a point to study his identification code. Its current verification code is as follows. Now I will explain the recognition step 1, convert the grayscale image 2, clear the 2px border 3, and split the number of verification codes (4) 4. After the above steps are taken to generate the model library, we can see the following results. The following code implements public String GetCheckString (Bitmap bitmap) {UnCodebase ud = new UnCodebase (bitmap); ud. grayByPixels (); ud. clearPicBorder (2); ud. cutMap (14, 15, 0, 0); bitmap = ud.bmp obj; // bitmap = ud. clearNoise (128, 1); String chkcode = ""; Bitmap [] arrmap = Ud. splitImg (bitmap, 4, 1); foreach (Bitmap item in arrmap) {String str = ud. getCodebybitmap (item, 128); Boolean isEques = false; foreach (String strss in code) {String [] a = strss. split (':'); if (str = a [1]) {chkcode + = a [0]; isEques = true; break ;}} if (! IsEques) {String strCurrent = ""; double max = 0.0; foreach (String strss in code) {int len1, len2, min, count = 0; String [] a = strss. split (':'); len1 = a [1]. length; len2 = str. length; min = len1; if (min> len2) {min = len2;} for (int I = 0; I <min; I ++) {if (str [I] = a [1] [I]) {count ++ ;}} double currrent = (count * 100.0/min ); if (max <currrent) {max = currrent; strCurrent = a [0]. trim () ;}} chkcode + = strCurrent. trim () ;}} return chkcode;} after these processing, the recognition success rate is over 90 + %,

Related Article

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.