Tesseract Foreground/background color

190 views
Skip to first unread message

David Varns

unread,
Jun 22, 2020, 6:27:29 AM6/22/20
to tesseract-ocr
Hello,

I tried running libtesseract (in C++) on an image with white text on a red background, and it failed to read it correctly.  However, when I inverted the colors to get black text on cyan background, it read the text perfectly.

It seems to be the case that tesseract by default, assumes the text is black?

Are you meant to alter the colors so that the foreground is black, or is there a way to tell it to determine the foreground/background colors itself?

(I am running the C++ library)

Thanks,
David

Mukkarram Moin

unread,
Jul 7, 2020, 12:50:48 PM7/7/20
to tesseract-ocr
David,
In my opinion, you have to convert background color to White and Foreground color to Black for best detection. I am doing similar kind of project and this combination gives the best result. You have to convert the color by using opencv easily... One more important think is that, if the image size is small then you have to magnified image (twice recommended) for better result.
ok22.png
Reply all
Reply to author
Forward
0 new messages