how to generate image of small font size with text2image?

495 views
Skip to first unread message

陈奕润

unread,
Feb 4, 2022, 11:24:12 AM2/4/22
to tesseract-ocr
I use tesseract to recognize game texts, which has a very small font size, so I want to generate images of small font size to fine tune tesseract, but after a few tries, I was not able to get the image I want. What am I doing wrong?
test.pngsample_text.png
the first image is cut from game and enlarged twice the size, it looks the same with SimSun font in size 9.
the second image is generated by text2image, command is:
text2image --fonts_dir=fonts_my --font=SimSun --text=tmp/sample_text.txt--xsize 300 --ysize 50 --margin 0 --ptsize 9

I've uploaded the font I use, and the text is "蝙蝠翅膀".

陈奕润

unread,
Feb 4, 2022, 11:27:01 AM2/4/22
to tesseract-ocr
due to file size limit, I couldn't upload the font file, the but the font is available in C:\Windows\Fonts

陈奕润

unread,
Feb 4, 2022, 11:28:02 AM2/4/22
to tesseract-ocr
any help would be much appreciated

Manuth Vann

unread,
Feb 4, 2022, 1:31:44 PM2/4/22
to tesser...@googlegroups.com
Can I have a look with the error message ? 

--
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/575e9623-b85f-4a9d-af49-64bc08d59ec4n%40googlegroups.com.

陈奕润

unread,
Feb 4, 2022, 1:47:12 PM2/4/22
to tesseract-ocr
Sorry that I didn't describe clearly, there is no error message, the problem is the generated image look different than how the font is used elsewhere, which affects recognition accuracy.
Take  windows' wordpad for example, the character ’蝙' in font NewSun will become pixelated and omit some strokes in small font size, other application is the same.
111.png
But with text2image, I can't get such pixelated characters even if I set the --ptsize to a low value, such as 9 or 5.
Reply all
Reply to author
Forward
0 new messages