PDA

View Full Version : OCR.recognize character mis-match



slushpuppy
08-15-2022, 07:31 PM
Hi,

Using this code sample to read characters off a UI


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:

28928

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

https://imgur.com/Fy0W4MS

slacky
08-16-2022, 01:09 PM
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.

Olly
08-16-2022, 08:08 PM
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`.

slushpuppy
08-17-2022, 05:38 AM
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?

slushpuppy
08-17-2022, 05:40 AM
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?

Olly
08-21-2022, 09:51 PM
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.