A Simple grayscale image cannot be OCR'd

104 views
Skip to first unread message

Andrew

unread,
Dec 11, 2022, 2:48:40 AM12/11/22
to tesseract-ocr
I have processed imaged that seems pretty simple:

1) The image is gray scale
2) The image is 300 dpi
3) The font is Arial 20 pt (72 dpi)

The image can be found here: https://i.imgur.com/8fXlqZY.png

Tesseract (via tesseract.js) is unable to OCR this image. I have read the https://github.com/tesseract-ocr/tessdoc/blob/main/ImproveQuality.md doc (hence the grayscale and dpi changes). I have also tried PSM 7.

For fun, if I can remove the gray box it will OCR just fine, but this is a little problematic for me algorithmically.

Any suggestions on how to get this to work?

Alessandro Weber

unread,
Dec 11, 2022, 2:41:39 PM12/11/22
to tesseract-ocr
Hi Andrew,

your thought is exactly what I would do: replace RGB (201, 201, 201) with RGB (255, 255, 255) and then process the image with text on white ground. : )

Ale

Zdenko Podobny

unread,
Dec 11, 2022, 3:03:39 PM12/11/22
to tesser...@googlegroups.com
run this to understand what it problem:

> tesseract 8fXlqZY.png 8fXlqZY --psm 7 get.images

Then check the binarized version of your input that is used for OCR: 8fXlqZY.processed.tif

There are 2 simple ways to solve the problem:
  1. using only text ares for OCR (e.g. cropping image to text with 10 pt border)
  2. using other (non-default) thresholding method

Zdenko


ne 11. 12. 2022 o 8:48 Andrew <andre...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/0ddf5cb5-bc7d-45db-9ba6-bd638b561b9fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages