Verification Code Identification Technology (iii) noise removal

Source: Internet
Author: User

For the noise removal technology, there is no unified algorithm, but a site verification code noise, there must be some rules. Only by analyzing this rule can we write the corresponding code to remove the interference.

For example, with the second step, we have removed the background of a CAPTCHA image,

It is obvious that this verification code picture, by the time of the late, added an interference line, and the interference line out of Pixel point of the same thing, that is good to do, we can write a program, sequence of scanning this interference line, and then dynamic removal. We can analyze the pixels in the second step, and analyze the interference data easily.

The specific code is as follows:

/*** Go to Noise (remove interference line) * *@paramImage * Original image *@returnPictures After going to the noise*/     Public Staticbufferedimage startdenoising (bufferedimage img) {intwidth =img.getwidth (); intHeight =img.getheight ();  for(intx = 0; x < width; X + +) {            //point of record sequenceList<pixcolorshow> pixcolorshowlist =NewArraylist<pixcolorshow>();  for(inty = 0; Y < height; y++) {color color=NewColor (Img.getrgb (x, y)); Pixcolorshow Pcolorshow=Newpixcolorshow (); Pcolorshow.pixvalue=color.getred (); Pcolorshow.ycoordinate=y;            Pixcolorshowlist.add (pcolorshow); }            //Judging Continuous pointsStringBuffer Sbuffer =NewStringBuffer ();  for(intindex = 0; Index < pixcolorshowlist.size (); index++) {                if(Pixcolorshowlist.get (index). Pixvalue < 100) {sbuffer.append ("1"); } Else{sbuffer.append ("0"); }} String showstring=sbuffer.tostring (); //System.out.println (showstring);ArrayList<Integer> seriespointlist=NewArraylist<integer>(); Pattern Pattern= Pattern.compile ("0110"); Matcher Matcher=Pattern.matcher (showstring);  while(Matcher.find ()) {intStartpoise =Matcher.start (); intEndpoise=Matcher.end ();  while(startpoise<endpoise)                    {Seriespointlist.add (startpoise); Startpoise++; }                        }                                            //Removing continuous points             for(intI=0;i<seriespointlist.size (); i++) {Img.setrgb (x, Seriespointlist.get (i), Color.WHITE.getRGB ()); }        }        returnimg; }

Verification Code Identification Technology (iii) noise removal

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.