SRL Archive - Help and Support

Inaccurate OCR


riwu

2014-12-01 10:30:10

http://puu.sh/dcKh1/45aa309b88.png
any idea how to grab the correct name for the above? can be from either uptext, chatbox text, or the mainscreen text.

I used GetTextAtEx() and SmallChars07 for all the 3 areas, it always returns 'EEN KPPEJE'.
Target the puush image and run the following:

begin
writeln(GetTextAtEx(8, 415, 82, 430, 0, 5, 2, 12926, 0, SmallChars07));
end.

slacky

2014-12-01 11:27:35

The OCR-engine in Simba relies on splitting the characters, so any characters that are connected will be "ignored", or read wrongly.

For the uptext, you can use the OCR-uptext engine I have provided, I THINK it should be able to handle it correctly. That engine is used by Aerolib, so go a head and see if it works. If it doesn't work, it could be fixed by modding the fonts I assume.
If my OCR failed, and you wanna try modding the fonts (ps: back up old fonts): Remove the vertical black border-lines which is used to shift the font left or right (direction varies), I don't remember if that will make a diff tho.

The other spots can be read with a modified version of the OCR-engine which I have around here somewhere…

You can also test out using Tesseract.

Edit: Spent a few minutes with Simba to create a single engine able to read all those texts (including regular uptext) just for lols:
- http://i.imgur.com/ldj6A1K.png (seems to work fine)

Hoodz

2014-12-01 11:46:19

From: riwu
http://puu.sh/dcKh1/45aa309b88.png
any idea how to grab the correct name for the above? can be from either uptext, chatbox text, or the mainscreen text.

I used GetTextAtEx() and SmallChars07 for all the 3 areas, it always returns 'EEN KPPEJE'.
Target the puush image and run the following:

begin
writeln(GetTextAtEx(8, 415, 82, 430, 0, 5, 2, 12926, 0, SmallChars07));
end.


mmh, have you tried it with AeroLib?

riwu

2014-12-02 07:03:33

From: slacky
The OCR-engine in Simba relies on splitting the characters, so any characters that are connected will be "ignored", or read wrongly.

For the uptext, you can use the OCR-uptext engine I have provided, I THINK it should be able to handle it correctly. That engine is used by Aerolib, so go a head and see if it works. If it doesn't work, it could be fixed by modding the fonts I assume.
If my OCR failed, and you wanna try modding the fonts (ps: back up old fonts): Remove the vertical black border-lines which is used to shift the font left or right (direction varies), I don't remember if that will make a diff tho.

The other spots can be read with a modified version of the OCR-engine which I have around here somewhere…

You can also test out using Tesseract.

Edit: Spent a few minutes with Simba to create a single engine able to read all those texts (including regular uptext) just for lols:
- http://i.imgur.com/ldj6A1K.png (seems to work fine)

That's amazing! Are u planning to release the new engine? Would be really useful for everyone.

I tried ocr_ReadText(), returned EEN K.PPETJE|. Tesseract doesnt work either (returned EEN HF'F‘EUE)

slacky

2014-12-02 22:30:54

From: riwu
That's amazing! Are u planning to release the new engine? Would be really useful for everyone.

I tried ocr_ReadText(), returned EEN K.PPETJE|. Tesseract doesnt work either (returned EEN HF'F‘EUE)

Sure. Just need to add some finishing touches to it, and compile it in to a plugin.

You can however test the prototype already (pure lape with no requirements):
- http://slackworld.net/browser/?view=files/RS/SimpleOCR_proto.simba
If you deside to use that prototype let me know how it runs.

riwu

2014-12-07 01:28:42

From: slacky
Sure. Just need to add some finishing touches to it, and compile it in to a plugin.

You can however test the prototype already (pure lape with no requirements):
- http://slackworld.net/browser/?view=files/RS/SimpleOCR_proto.simba
If you deside to use that prototype let me know how it runs.

Works perfectly! Any idea why i couldnt get the last line of the chat box though? (the line that contains your character name)

OCR.LoadFont('SmallChars07');
i:= 7;
WriteLn(OCR.Recognize(TBox([8,359+(14*i),480,374+(14*i)+1]), OCR_RULES_CHATBOX)); //Uses threshold (nice for chatbox)

slacky

2014-12-07 07:22:01

From: riwu
Works perfectly! Any idea why i couldnt get the last line of the chat box though? (the line that contains your character name)

OCR.LoadFont('SmallChars07');
i:= 7;
WriteLn(OCR.Recognize(TBox([8,359+(14*i),480,374+(14*i)+1]), OCR_RULES_CHATBOX)); //Uses threshold (nice for chatbox)

The reason should be fairly obvious: Incorrect coordinates for the textarea. Those coordinates there fits the "message-area" not the textarea, the textarea is shifted 1 or 2px further down.
PS: I have released the engine here https://villavu.com/forum/showthread.php?t=111156

With the plugin it would probably be something like this, but you might still have to tweak the coordinates, I have nothing to test on:
OCR.Init('SmallChars07');
WriteLn(OCR.Recognize([9,459,480,474], OCR_RULES_CHATBOX));

riwu

2014-12-07 09:29:45

From: slacky
The reason is pretty darn obvious: Incorrect coordinates for the textarea. Those coordinates there fits the "message-area" not the textarea, the textarea is shifted 1 or 2px further down.
PS: I have released the engine here https://villavu.com/forum/showthread.php?t=111156

With the plugin it would probably be something like this, but you might still have to tweak the coordinates, I have nothing to test on:
OCR.Init('SmallChars07');
WriteLn(OCR.Recognize([9,459,480,474], OCR_RULES_CHATBOX));

I did change the coordinates several times, didnt know it has to be so exact…
Changing the y1 (459) by even a single pixel (eg. 458/460) will return blank/dots.

Thanks for the help!

slacky

2014-12-07 10:40:10

From: riwu
I did change the coordinates several times, didnt know it has to be so exact…
Changing the y1 (459) by even a single pixel (eg. 458/460) will return blank/dots.

Thanks for the help!

Yeah, I forgot to mention that, hehe :-P