lam*_*ter 1 tesseract python-2.7 python-tesseract
我正在使用 pytesseract 和以下行:
text = image_to_string(temp_test_file,
lang='eng',
boxes=False,
config='-c preserve_interword_spaces=1 hocr')
Run Code Online (Sandbox Code Playgroud)
并得到错误
pytesseract.py
135| f = open(output_file_name, 'rb')
No such file or directory:
/var/folders/j3/dn60cg6d42bc2jwng_qzzyym0000gp/T/tess_EDOHFP.txt
Run Code Online (Sandbox Code Playgroud)
在这里查看 pytesseract 的源代码,似乎无法找到用于存储 tesseract 命令输出的临时输出文件。
我在这里看到了其他答案,这些答案已通过检查 tesseract 是否已安装并可从命令终端调用来解决,对我来说是这样,所以这不是这里的问题。任何想法这可能是什么以及如何解决它?谢谢
使用预期的输出格式来启动配置字符串:
config_str = "-l eng --oem 4 --psm 7"
text = pytesseract.image_to_string(img, config=("txt "+config_str))
# or for more meta-info:
data = pytesseract.image_to_data(img, config=("tsv "+config_str))
Run Code Online (Sandbox Code Playgroud)