CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Aug 2008
    Location
    C:\Windows\System32
    Posts
    47

    Get Text / Numbers from image

    i'm wondering is it possible to get text numbers from an image in c#?
    example image:

    if it's possible can someone give a tutorial ? or a pointer to what i need to do?

    Thanks in advance
    ~Cha0sBG

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Get Text / Numbers from image

    No it is not possible as of now. May be in the future it might be possible. Have you heard of OCR's?

    By the way, isn't that a captcha? What are you trying to do?

  3. #3
    Join Date
    Aug 2008
    Location
    C:\Windows\System32
    Posts
    47

    Re: Get Text / Numbers from image

    well a friend of mine made a program that generates images like that. And if i make a program to decode those images he'll give me a gift cuz he knows i can't make it so i ask for help. And i'll learn some more c# aswell ^^

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Get Text / Numbers from image

    Quote Originally Posted by Cha0sBG View Post
    well a friend of mine made a program that generates images like that. And if i make a program to decode those images he'll give me a gift cuz he knows i can't make it so i ask for help. And i'll learn some more c# aswell ^^
    No you can't do it. And this is not the way to learn C#. use some other examples.

  5. #5
    Join Date
    Aug 2008
    Location
    C:\Windows\System32
    Posts
    47

    Re: Get Text / Numbers from image

    i mean is it possible ... to make a OCR server i dont ask u to give me the code ^^ i just wanna ask is it possible and if it is just a little pointer to what i need to learn to astablish that.

  6. #6
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Get Text / Numbers from image

    Honestly speaking, there has been a lot of research done on OCRs and none of them have been 100% successful.

  7. #7
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Get Text / Numbers from image

    Like Shuja said, this is a bad way to learn a language, and it could be used by other people to avoid CAPTCHA's, so no one will post the code here. If you find a way to make 100% effective OCR software, you should tackle some of the NP Complete problems in CS next

  8. #8
    Join Date
    Aug 2008
    Location
    C:\Windows\System32
    Posts
    47

    Re: Get Text / Numbers from image

    i don't want a way to avoid all captchas just those that look like that. Only to avoid the captchas of my friend's program nothing more i dont wanna brake captchas of sites etc -.-

  9. #9
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Get Text / Numbers from image

    We never said that you want to do that. We only said that if that code exists and that code is posted here it will be misused.

    Anyways, Captcha is a security add-on and it is not always easy to beat the security. So you can forget about this little experiment and try doing something else in order to learn C#. Look at this forum, there are number of problems posted here, take one of the problem and try to solve it and see if you can get some learning out of it.

  10. #10
    Join Date
    Dec 2006
    Location
    New York Brooklyn
    Posts
    120

    Re: Get Text / Numbers from image

    It's possible it's been on on a game called runescape classic which generated similar images..

    what you do is first attempt to create every letter character as accurate to perfect font-type as possible.

    This is done by rotating the whole string of words in your case counter-clockwise rotation.
    To rotate images look for code on google. (Tons of examples exist I'd look for sprite rotator and rip that code). Now keep testing each rotation to get every letter near 90% or higher maybe even 100% in your case i dont see that much problems in your image its pretty easy to decode.

    Now how do get %'s of image words? well you create a pixel array of every letter from A-Z to a-z
    and search for these matches using GetPixel API from windows.

    Those lines will effect your % but you don't have to worry to much about them but they can be removed as well using the % system.. say you match a Q.. with 100% then erase everything that is extra detected inside it.

    It's not that much coding.. the hardest part in my opionion would be getting every letter into a binary array

    1's for matches 0's for empty spots..


    Now there is another thing which makes this easier each letter has a perfect spacing so you can just use math like x+3 y+5 when you are looping to get the whole word..

    without spacing you would have to scan the whole image and find any 99-100% matches and store the locations of x,y start positions into another array then sort that array and lowest y coordinate letter goes first.. etc.. simple

  11. #11
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Get Text / Numbers from image

    Well you are talking about a game and not a real captcha. Breaking a captcha is very difficult, although your explanation above sounds simple enough, but I am sure it won't be an easy task.

  12. #12
    Join Date
    Aug 2008
    Location
    C:\Windows\System32
    Posts
    47

    Re: Get Text / Numbers from image

    ouch that looks hard as hell for me well first i'll try to rotate the image ^^ i'll post the progress here :P

  13. #13
    Join Date
    Dec 2006
    Location
    New York Brooklyn
    Posts
    120

    Re: Get Text / Numbers from image

    Quote Originally Posted by Shuja Ali View Post
    Well you are talking about a game and not a real captcha. Breaking a captcha is very difficult, although your explanation above sounds simple enough, but I am sure it won't be an easy task.

    wrong.. the game im talking about is the same as a real captcha.. I'd like to add it doesn't matter which way you rotate the image.. counter-clockwise etc.. so don't worry if each different captcha has different way of rotation.. just do a full 360 rotation and each rotation do a check for accuracy of first letter/middle letter.

    here is some of the captchas the game im talking about generated





    the OCR written for it.. had a 95-100% accuracy and source code was released but it was maybe 8 years ago.. i dont know if its possible to find it now it was written in C++

  14. #14
    Join Date
    Aug 2008
    Location
    C:\Windows\System32
    Posts
    47

    Re: Get Text / Numbers from image

    well currently i only inverted the colors. Meaning black = white and white = black :P changed the places so to speak. Image attached. Any ideas on how to clean it from the black spots and lines?
    Attached Images Attached Images

  15. #15
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Get Text / Numbers from image

    Again, you are asking how to break a specific CAPCTHA and no one here is going to publicly help you to do it. It doesn't matter what your intentions are, it can be misused by others.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured