Jump to content

CAPTCHA Recognition

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
I have a job where I need to recognize these little images. I have attached a picture of one. From what I can tell they are all like this: same colors, same font, same size, just twisted this way and that.

My theory is to just scan the image for 5 characters which should be easy since it's all surrounded by that gray color. Then just try putting a letter over it and seeing how many of the pixels change... twisting it a degree every time until I find the lowest possible moved pixels and assuming that is the letter.

That would probably take forever though. It might be easier just to save 360 files of each letter in each direction and comparing the md5 of the file against all of the md5's of those files. This might be a little too precise and not work since if it's just a little off it won't work. I know if I trim the images then it would be more accurate but it still seems inaccurate to me... this would just require testing.

What are your thoughts?

Posted Image

#2
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
woohooo another Hack attack I i i LOVE IT :D

#3
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Your too helpful. I don't know what I can do with such detailed theories.

#4
tate

tate

    Learning Programmer

  • Members
  • PipPipPip
  • 90 posts
I would separate each letter in the captcha image, and compare the pixels of the letters with actual letters. I have done this before in java but i knew exactly what font the captcha letters were made from. Doing what you said with turning the image a little and comparing again is what i did too even though it doesn't seem like it would be fast. I sped up the process by lowering the percentage of pixels needing to match and i resized the images to be smaller thus fewer pixels to compare.
twas brillig

#5
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Do you happen to have any of that source? I'm sure any of it would save me some time.

Another idea is that the letters don't go the full 360, I'll keep refreshing it and seeing the furthest it goes that will save major time since it only looks like it goes about 45 degrees each way (just by eyeballing it). So me, my refresh button, and photoshop will have some quality time :]

#6
tate

tate

    Learning Programmer

  • Members
  • PipPipPip
  • 90 posts
I can't legally give you any of the code. One thing to help with the orientation of the letters is to look for straight lines and use those to orient the captcha letters as much as you can before hand. it makes the letters "abdfghijklmnpqrtuvwy" that have straight parts of certain lengths much easier to orient. on letters "vwy" orient them so one part is straight up and down. "x" is very easy to find when looking for straight lines. this will likely save you a lot of frustration.
twas brillig

#7
kmhosny

kmhosny

    Programmer

  • Members
  • PipPipPipPip
  • 133 posts
well you can do is create a data set for all letters separated with let's say 4 representation for each letter with each representation have different font size, and for each image you extract what is called Feature Vector which is a vector with numbers describing the information of the image, there are a lot of techniques for generating feature vectors one of them is dividing the image into blocks e.g 4*4 blocks and for each block get the average number of pixels in X axis and average number of pixels in Y axis and save it for each block, you feature vector length will be 16 and each element contains avg X and avg Y, this is called centroid feature extractor.
now you can save the feature vector of each image on a file and load it when ever you want to test an image, by extracting feature vector for the image to test and compare it with the saved features by using any distance comparison technique
as for captcha you will need to separate the letters and test each letter by itself as tate said and then extract and compare.
"Recursion is just a line of code"
-Karim Hosny-
My flickr

#8
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I'd recommend using a feed forward neural network. That is how most optical character recognition software works. You can check out my non-neural network Basic OCR

#9
kmhosny

kmhosny

    Programmer

  • Members
  • PipPipPipPip
  • 133 posts
but isn;t FFNN is for classification?
"Recursion is just a line of code"
-Karim Hosny-
My flickr

#10
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Not entirely sure. I'm pretty new to neural networks, but from my understanding, a multi-layer perceptron with back-propagation should suffice.

#11
kmhosny

kmhosny

    Programmer

  • Members
  • PipPipPipPip
  • 133 posts
yes you are right John but that would be after extracting the feature of the image., and use the feature vector as input and the 26 letter of alphabet as output where the highest output at a certain neuron will show that this is the letter.
there is another way to do but i do not recommend as i tried it before and it didnt give me accurate results by having the number of input neurons same as the image size e.g 16*16 image then 256 input neuron and the output neurons 26 for alphabet and consider each pixel value as the input to the corresponding input neuron e.g. pixel 10,10 is 1 so at neuron 100 put a 1 and so on.
"Recursion is just a line of code"
-Karim Hosny-
My flickr

#12
Casey

Casey

    Newbie

  • Members
  • Pip
  • 5 posts
I don't condone bypassing website security features for personal gain, but I think this is an interesting problem.

I also think you're going about it entirely the wrong way (comparing to sample data for percentile matches).

Each individual letter of the alphabet has distinct physical features that allow us to recognize it. These features break down into a series of lines and curves with specific intersections, forms, handedness, etc. What you need to develop is a program that detects lines, curves, and intersections; checking the sum of these instances against 26 sets of characteristics for matches. I'd start out looking for either opensource function detection or handwriting recognition software to adapt, though it'd be more fun to start from scratch.