TextRecognitionDataGenerator
TextRecognitionDataGenerator copied to clipboard
How to specify the font to be used?
My need is really simple, given a text and a ttf font file, output the images augmented. However, the example in README.md does not work as I expected.
After I read your doc, I think the following code should be correct,
from trdg.generators import (
GeneratorFromDict,
GeneratorFromRandom,
GeneratorFromStrings,
GeneratorFromWikipedia,
)
# The generators use the same arguments as the CLI, only as parameters
generator = GeneratorFromStrings(
['Test1', 'Test2', 'Test3'],
blur=2,
random_blur=True,
fonts = load_fonts('my_font_folder')
language = 'my_font_folder'
)
However, the trdg just ignore 'my_font_folder', it just uses the fonts in 'en' folder and use en language
ttf files are in the 'my_font_folder'
Did you ever resolve this issue? I am looking at the same problem.
Try mentioning the .ttf file in the font parameter and the path to the font folder in the font directory parameter