如何定义tesseract在识别时使用的字体类型(不在培训中)?

时间:2014-05-02 05:29:45

标签: c++ fonts ocr tesseract true-type-fonts

对于我可下载的英文数据集

cat tessdata/eng.* | egrep -o ".*ttf" | sort -u

并获取在英语培训中使用的所有字体的列表

Andale_Mono.ttf
Arial_Black.ttf
Arial_Bold.ttf
Arial.ttf
buttf
Comic_Sans_MS_Bold.ttf
Comic_Sans_MS.ttf
Courier_New_Bold.ttf
Courier_New.ttf
Georgia_Bold.ttf
Georgia.ttf
Gottf
Impact.ttf
Times_New_Roman_Bold.ttf
Times_New_Roman.ttf
Trebuchet_MS_Bold.ttf
Trebuchet_MS.ttf
ttf
Verdana_Bold.ttf
Verdana.ttf

现在我想识别一个我已经知道fonttype的文本,所以我想限制对它的识别。我试过了:

api.SetVariable("classify_font_name", "Arial_Bold.ttf");

但我没有看到更好的结果。有人可以告诉我如何做到这一点,或者甚至可能吗?

1 个答案:

答案 0 :(得分:-1)

您可以使用LTRResultIterator类及其WordFontAttributes方法获取字或字符级别结果的字体信息。获得字体属性后,可以根据特定的字体名称条件过滤输出文本。请参阅Tesseract API examples