Captcha Breaking with PHP GD

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Re: Captcha Breaking with PHP GD

Post by tremor77 on Fri Aug 06, 2010 9:41 am
([msg=43343]see Re: Captcha Breaking with PHP GD[/msg])

that K looks almost like an X. Those are pretty fugly captcha letters, once you get them separated they still look like a pain in the arse. Do you know if this is a standard captcha program or one that's custom made? Like... is it part of a standard CMS?
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Captcha Breaking with PHP GD

Post by TheMindRapist on Fri Aug 06, 2010 1:22 pm
([msg=43359]see Re: Captcha Breaking with PHP GD[/msg])

adlez wrote:Yes here is what the original image looks like.
Image

And thanks for that tip I will mess with it.

You say the background is always the same, I assume that means it always has the same colors, and that those colors are unique. If so, setting to white all pixels with the background colors that do not touch a pixel with a non-background color, then setting to white all pixels that are not a background color then setting to black everything that is not white might give you something clearer to work with.

Edit: Actually, I can't tell if the outline has background colored pixels in it from looking at the image so this may not work.
Image
User avatar
TheMindRapist
Contributor
Contributor
 
Posts: 585
Joined: Mon Apr 14, 2008 4:57 pm
Blog: View Blog (0)


Re: Captcha Breaking with PHP GD

Post by adlez on Fri Aug 06, 2010 1:43 pm
([msg=43361]see Re: Captcha Breaking with PHP GD[/msg])

Just an update on where I'm at.

Using the method suggested above I have been able to get the xy values.
Code: Select all
*60,18
53,19
*161,19
*16,20
158,20
13,21
*134,21
11,22
127,22
10,23
9,24
123,24
8,25
*93,25
7,26
6,27
5,28
4,29
2,34
80,59

The ones with a * next to them are the 5 I need. I'm having difficulty filtering out the rest. I will paste the the method I'm using and continue to debug. If any of you have any suggestions, as always they are greatly appreaciated.

Code: Select all
$coord = array();
for($y=0;$y<$h;$y++) {
  for($x=0;$x<$w;$x++) {
   $rgb = imagecolorat($im, $x, $y);
   $data = imagecolorsforindex($im,$rgb);
   if ($data['red'] == 0){
   ////////////////////////////
    if (!isset($coord[0])){
     $coord[0] = array($x,$y);
     break;
    }else{
     $i = count($coord);
     $coord[$i] = array($x,$y);
     $white = imagecolorallocate($im,255,255,255);
     for ($a=$x;$a<$x+40;$a++){
      for ($b=$y;$b<$y+40;$b++){
       imagesetpixel($im, $a,$b, $white);
      }
     }
    }
    /////////////////////////////
   //once a black pixel is found, make all pixels with a 40x40 radius white//
   }
  }
}


-- Fri Aug 06, 2010 1:46 pm --

TheMindRapist wrote:
adlez wrote:Yes here is what the original image looks like.
Image

And thanks for that tip I will mess with it.

You say the background is always the same, I assume that means it always has the same colors, and that those colors are unique. If so, setting to white all pixels with the background colors that do not touch a pixel with a non-background color, then setting to white all pixels that are not a background color then setting to black everything that is not white might give you something clearer to work with.

Edit: Actually, I can't tell if the outline has background colored pixels in it from looking at the image so this may not work.


To clarify, the background for all captchas is that light blue color with the criss cross lines.
adlez
New User
New User
 
Posts: 9
Joined: Wed Aug 04, 2010 5:43 pm
Blog: View Blog (0)


Previous

Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests