Jump to content

myOCR


peethebee
 Share

Recommended Posts

Hi!

I coded a OCR script which is similar to one posted by someone before in order to read text in Diablo II (I think).

The important thing will be that in one of the next few versions an editor will make it possible to edit the character's data either manually or AUTOMATICALLY.

I would like you to test it and see the (I think impressive) screenshots.

peethebee

Edit: The script can be grabbed in my fileman!

testimage.bmp

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

This text has been painted in MS Paint This is no special font. It compares a brunch of pixels where you can define if the pixel in relation to the starting pixel of the character HAs to be a special color or MUSN'T be of the color.

Look in the .ocr file to see the data (it's just a simple ini file)

Please ask your technical questions if there are more of them.

It takes about 2 sec I think on a 1.500 Ghz AMD Sempron with 256 MB RAM.

peethebee

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

I'm waiting for your results...

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Thank you, w0uter!

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

0.5 Beta inculdes a early (but working) version of the editor and a text file with tips how to speed up the scanning process.

Grab it via fileman.

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Ah, yes I created the original D2 OCR :whistle:

I actually ported it over to C#, it's about 100x faster.

EDIT:

I can't get yours to run correctly, I open up the image in paint and run both the exe and au3 file.

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Hi!

100 times faster... not bad *g*.

You store the data similar to be, don't you?

Is there an editor aailible for your project?

Perhaps I could try to code one of not.

Deit: It should move the mouse to the start of the character. Perhaps try to use the other .ocr file as source, cause I played around very much with them.

peetehebee

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

100 times faster... not bad *g*.

You store the data similar to be, don't you?

Is there an editor aailible for your project?

Perhaps I could try to code one of not.

peetehebee

<{POST_SNAPBACK}>

Editor, oh no, that'd be very hard :whistle:

Mine's specific and built for speed, not reusability. I store the data very differently, here's a snippit of the character definitions:

class OCRDefinition
{
    private Hashtable Definitions = new Hashtable();
    
    public OCRDefinition ()
    {
        // A-Z
        Definitions.Add ( "-1,0;-1,-1;-2,0;-2,-1;-8,0;-8,-1;", "A" );
        Definitions.Add ( "-1,0;-1,-1;-1,-2;-1,-3;-1,-4;-1,-5;-1,-6;-1,-7;-1,-8;-2,0;-2,-1;-2,-2;-2,-3;-2,-4;-2,-5;-2,-6;-2,-7;-2,-8;-3,0;-3,-3;-3,-7;-4,0;-4,-2;-4,-3;-4,-7;-5,0;-5,-1;-5,-2;-5,-3;-5,-4;-5,-5;-5,-6;-5,-7;", "B" );
        Definitions.Add ( "-1,0;-1,-1;-1,-2;-2,-1;-2,-2;-2,-3;-3,-3;-3,-4;-4,-4;-4,-5;-5,-4;-5,-5;-6,-4;-6,-5;-7,-4;", "C" );
        Definitions.Add ( "-1,0;-1,-1;-1,-2;-1,-5;-1,-6;-1,-7;-1,-8;-2,0;-2,-1;-2,-2;-2,-3;-2,-4;-2,-5;-2,-6;-2,-7;-2,-8;-4,0;-4,-7;-5,0;-5,-7;-6,0;-6,-1;-6,-6;-6,-7;-7,-1;-7,-2;-7,-3;-7,-4;-7,-5;-7,-6;", "D" );
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Hi!

ok. I will stay with my project *g*.

But I think you also store a set of coordinates of the pixels, don't you?

Edit: Does the scanning work now?

peethebee

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

I got it to work, sorry I went to eat a snack. I forget completely what I did to change it. I think I used a different picture (the ABC.. one)

I do not set a coordinate of the pixels? The "0,1;0,2;" are the distances of the pixels from the top left most part of the character.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

I do the same thing (relative coordinates = distances).

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Yes but you also save the pixels, and you have a seperate definition for each pixel of a character, whereas I only have 1 definition for an entire character.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Hi!

This is a feature for chars which are not mono-colored.

I just read the forum thread about plugins in C/C++.

As you seem to be a skilled C# coder I would suggest that we (or you) could write a plugin to scan a part of the screen. It could be almost as fast as your solution and at the same time as open for other fonts as my way to implement it.

If you do not want to help me I would like to see your C# code as I justz started to code C++.

Thank you, peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

This is a feature for chars which are not mono-colored.

I just read the forum thread about plugins in C/C++.

As you seem to be a skilled C# coder I would suggest that we (or you) could write a plugin to scan a part of the screen. It could be almost as fast as your solution and at the same time as open for other fonts as my way to implement it.

If you do not want to help me I would like to see your C# code as I justz started to code C++.

Thank you, peethebee

<{POST_SNAPBACK}>

You can get the entire project here: http://insolence9.com/downloads/RealOCR.zip

You'll need SharpDevelop (www.icsharpcode.com I think)

If I linked to the wrong archive, let me know :whistle:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Hi!

Thanks for sharing the source. I got it to run, but it showed many MsgBoxes so that I have to remove them in order to see, if the scanning works.

peethebee.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

Thanks for sharing the source. I got it to run, but it showed many MsgBoxes so that I have to remove them in order to see, if the scanning works.

peethebee.

<{POST_SNAPBACK}>

Yeah, I had to do a lot of debugging in that sense, sorry :whistle:
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...