1. SRL Member
Join Date
Oct 2011
Posts
422
Mentioned
15 Post(s)
Quoted
116 Post(s)

OCR.recognize character mis-match

Hi,

Using this code sample to read characters off a UI

Code:
OCR.Recognize(clanNameBounds[i],TOCRColorRule.Create([16777215]), RS_FONT_PLAIN_12)
I note that the OCR engine can't seem to differentiate between "p" and "o" inspite of updating the font set

I have attached the images below:

lwOJ2ts.png

I can't seem to upload bmps so here is the font file i am using for ascii 112

https://imgur.com/Fy0W4MS

2. Unsure about this one. I'd honestly expect the "g" to be the problem here, as the "p" looks fine. Might be that the p you have replaced it with is not correctly centered, or the width of the image being too much.
Last edited by slacky; 08-16-2022 at 01:13 PM.

3. SimpleOCR requires every pixel of the character for a match. The some pixels on the bottom of the p are hidden, so that is why it's thinking it's a o.

4. SRL Member
Join Date
Oct 2011
Posts
422
Mentioned
15 Post(s)
Quoted
116 Post(s)
Originally Posted by slacky
Unsure about this one. I'd honestly expect the "g" to be the problem here, as the "p" looks fine. Might be that the p you have replaced it with is not correctly centered, or the width of the image being too much.
you are spot on. so basically this is for a pserver and the menu item i am trying to read doesn't have proper vertical padding so letters like p, g, and even q have their bottoms chopped off. I guess the issue is how I am creating the bitmap file. When you mentioned correctly centered, what are the best practices for creating bitmap file?

5. SRL Member
Join Date
Oct 2011
Posts
422
Mentioned
15 Post(s)
Quoted
116 Post(s)
Originally Posted by Olly
SimpleOCR requires every pixel of the character for a match. The some pixels on the bottom of the p are hidden, so that is why it's thinking it's a o.
does this include the black mask?
Last edited by slushpuppy; 08-17-2022 at 10:30 AM.

6. Originally Posted by slushpuppy
does this include the black mask?
The black mask is used but it's not the entire black on the font bitmap. It's just the black pixels in the bounds of the (white) character.
And the black mask hits don't have to be perfect, iirc anything > 50% is good.