tesseract(v3.03)输出为PDF

cla*_*rkk 4 linux ocr tesseract

为什么会返回此错误?

root@amd-3700-2gb ~/ocr_test # tesseract -l dan pdf.png out pdf
Tesseract Open Source OCR Engine v3.03 with Leptonica
Error opening data file /usr/local/share/tessdata/osd.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'osd'
Tesseract couldn't load any languages!
Warning: Auto orientation and script detection requested, but osd language failed to load
Run Code Online (Sandbox Code Playgroud)

语言清单

root@amd-3700-2gb ~/ocr_test # tesseract --list-langs
List of available languages (3):
eng
dan
dan-frak
Run Code Online (Sandbox Code Playgroud)

输出为txt

这工作正常并输出文本 out.txt

tesseract -l dan pdf.png out
Run Code Online (Sandbox Code Playgroud)

输出PDF

这会创建out.pdf但也会返回提到的错误,并且PDF中的可搜索文本没有意义

tesseract -l dan pdf.png out pdf
Run Code Online (Sandbox Code Playgroud)

ngu*_*enq 6

错误消息很明确:它需要osd.traineddata文件.您可以从https://github.com/tesseract-ocr/tessdata安装或下载Tesseract的方向和脚本检测数据.