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