Sign in to follow this  
Followers 0
sumone4life

OCR Help

13 posts in this topic

Alrighty... so i am attempting to make an OCR for a captcha on a website. Now i have gotta as far as mapping the text into 1 and 0 in the console.

The captcha is pretty simple, it actually looks likes impact of a font like that, no background or anything so it shouldnt be too bad. Now my question is how do i go from a simple array or multi dimensional array to text that i can work with?

There are 3 letters/numbers in the captcha... am i going to have to separate them or can i compare them? I think ive done most of the work i just dont know how to compare them to a predefined list of letters and numbers perhaps...

Share this post


Link to post
Share on other sites



Yeh i think you have to separate and compare them for this to work. What is your array? The cords of pixels in the letters?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i havent actually put anything in an array yet... i have just written either a 1 or a 0 to the console.

a 1 represents a piece of the letter and a 0 represents the background. So basically it looks like this:

00000000000000000000000000000

00111111000000011100011111000

01111111100000111100111111100

01110011110001111101111011110

00000011110011111101111011110

00001111100111111100111111100

00001111101111011100111111100

00000011111111111111111011110

00000001111111111111110001110

01110011110000011101111011110

01111111100000011100111111100

00111111000000011100011111000

00000000000000000000000000000

That is what it looks like for 348. Now i have to find a way to compare that. Unfortunatly the letters are kinda close together making it more difficult. But maybe the spacing will be the same... who knows any ideas?

EDIT:

I have found a pattern to split up the letters. It goes 10 places -> 9 places -> 11 places. I have tried it with several examples and it works for all of them. So now that i know how to slit it up. I can make 3 arrays with the data in them and then i will have to go and make some definitions and compare the arrays. If i compare the two arrays they should be the same each time for the letter so a predefined list should work and wont take long to create (seeing as there is online letters a-z and #1-9)

So i guess my final question would be how i am going to need to create a multi dimensional array, and how do i compare two arrays to each other?

Edited by sumone4life

Share this post


Link to post
Share on other sites

well each number seems to be 10 symbols long. So you could take the top row first 10 1's and 0's and put them in a string and ten compare that string to an ini file and see if the match. Then just go to the next row and repeat the process until you get to the end.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I have found a pattern to split up the letters. It goes 10 places -> 9 places -> 11 places. I have tried it with several examples and it works for all of them. So now that i know how to slit it up. I can make 3 arrays with the data in them and then i will have to go and make some definitions and compare the arrays. If i compare the two arrays they should be the same each time for the letter so a predefined list should work and wont take long to create (seeing as there is online letters a-z and #1-9)

Doesn't look like that to me. 10 + 9 + 11 = 30, but there are 29 digits per line.

It looks like first virtical column is all 0, then 9 columns for each character, then a vertical column of all 0. The characters are all 9 x 11 in the example you have shown with a border of 0's all round.

You need

Dim $chars[125][11]

So

$chars[0][0] is the first line of the first character = '001110010' or whatever

$chars[0][1] is the second line etc

EDIT:spelling

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

If i could use that, it would definently be the prefered approach. but i dont know how to use COM and everything with auto it. I actually dont really know how to use INI and compare things with auto it. So if anyone knowswhere i can read about those two, i know the ini i can get form the help file so the COM would be most helpful to read about

EDIT:

I was just reading you contributions and saw a thing on Creating COM Objects without a neeed of DLL's. That sounds like what i need correct? i dont have time to read it right at the moment but i will definently take a look at it and see if i cant get this thing finished up. THank you

EDIT:

So many edits... anyway i have read your post on COMs and i can honestly say that i have no idea where to begin :) Im assuming i can just add the COM like you did in the examples and then use the same commands they use on the msndn?

Edited by sumone4life

Share this post


Link to post
Share on other sites

awsome that you VERY much.

Manadar the Captcha isnt much, you can get the sense of what it loosk like by going into word, and typing a 3 letter captcha with the font as impact black. Only thing is it has a orange backround but w/e same thing

Share this post


Link to post
Share on other sites

I have almost completed my program, i just have to put all the pieces together (Main program, OCR, etc). I actually used the way istarted doing it with pixel search and all that good stuff and it works! YAY!

Thanks you for all your help and ill have to take a look at the OCR COM that comes with office.

Share this post


Link to post
Share on other sites

Sorry if this isn't very relative, but there's a much simpler way than using an OCR. Just keep a library of images for the CAPTCHAs, and create an MD5 summary for the value of each image. Once the user submits their CAPTCHA value, MD5Sum that and compare it to the real MD5. If they're the same, then the user entered the correct code.


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

well the whole point of this is so the user doenst have to be there to type in a value. Also, there is no image, the image is actually a php script so i can just right click on the image or save it or somthing of that sort unfortnatly.

EDIT: I only have 1 more question...

so my problem is that is there a way to perform the OCR with pixelsearch in the background without it disturbing the user? im guessing not but i was just wondering if anyone knew a way of doing it. So i would need to somehow get autoit to see the captcha and then send the data.

Edited by sumone4life

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0