Jump to content
zippoxer

Failed to do OCR.

Recommended Posts

program New;


var
 chars: Integer;
 text: AnsiString;


begin
 chars := LoadChars2('C:\Zezenia Chars');
 text := GetTextAtEx(1876, 475, 0, chars, False, False, 1, 1, 11192520, 3, False, tr_AllChars);
 writeln(text);
end.

 

Always prints 3 spaces.

The charset: Zezenia Chars.zip

 

Each character is 6x8 (should be 7x8 but it doesn't matter since I specified 1px spacing, so SCAR skips the missing pixel).

The position I chose by looking at the first pixel of character 1 (49.bmp), then locating that pixel on the screen when my health is 123.

The color I picked with Auto Color Aid v2.exe which I found in the OSI's Tools directory.

 

I can't see the problem :\

 

Thanks.

Edited by zippoxer
Link to comment
Share on other sites

I did.

 

vih1qt.jpg

The top-left pixel of the number 158 in the picture is the top-left pixel of character 48 (= number 1) in the charset.

That pixel's location on the screen is 1876/475 and it's color is 11192520.

 

BTW: I got SCAR's OCR to work few years ago: http://villavu.com/forum/showthread.php?t=46646

There was a very good support for SCAR there, back then...

Edited by zippoxer
Link to comment
Share on other sites

I'm trying to recognize the player's health in a game. '230' in this picture: Untitled.bmp

I already made a charset (attached to the thread), found out the text color (11192520).

I also found the location of the text, which is 104/6 in this picture (and 1876/475 on my screen).

I'm not sure whether it's the information above incorrect or the way I use GetTextAtEx.

vih1qt.jpg

Link to comment
Share on other sites

Well there could be a lot of things wrong that you are doing preventing it from working correctly.

 

Tolerance is 0, check make sure the color is static

Try regular string instead of ansistring

Use 0, 2 for min/max spacing

Check your TextColor

Your Text length is only 3, unless you only expect to get three chars back you might want to make this bigger, make it as big as possibly would ever be and then some.

 

Lastly your char set may not be perfect, I'll check into this.

 

If all this still doesn't work, then it's possible the game you are playing has taken preventive measures like Runescape did with UpText (even though we got around them)

 

Try those things I mentioned while I try looking at your char set.

Link to comment
Share on other sites

The problem probably is that SCAR's current OCR system doesn't only check the color, it also checks whether the pixels outside of the character are different, if they aren't or they're too similar, it will fail. You should try to get everything that's inside fo the character's outline in your font and then use a slightly higher tolerance.

Link to comment
Share on other sites

14xpgdw.jpg

(a zoomed part of the game)

Most of the pixels in every character are 11192520 and I turned all of them to white while making the charset, the rest, which is what left to fill 6x8, I turned to black.

If the tolerance is 0, shouldn't SCAR skip (not compare with a character skeleton) all pixels that are not 11192520?

Link to comment
Share on other sites

I don't think those type of chars will be readable with SCAR at this time.

 

You could however create your own OCR (slow) and use bitmap loops, or create a plugin, maybe SCAR will be able to do this one day.

 

I could be wrong though, Freddy what do you think?

Link to comment
Share on other sites

Surprisingly, my charset works with tolerance 0 after I changed every character from 6x8 to 7x11 (except for few characters with more/less width) :o

One problem is that the health starts from a variable X position, depending on the amount of it's characters since it's right to left.

Anyway, I use the following to determine the start of right to left texts:

function FindTextStartX(xe, ys, maxLength, maxCharWidth, maxCharHeight, color: Integer): Integer;
var y: Integer;
begin
 FindColor(Result, y, color, xe - maxLength * maxCharWidth, ys, xe, ys + maxCharHeight);
end;

 

This way works, but can I use GetTextAt in reverse (to read from right to left)?

Edited by zippoxer
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...