如何在 python-tesseract 中设置 tessedit_write_images? [英] How to set tessedit_write_images in python-tesseract?
本文介绍了如何在 python-tesseract 中设置 tessedit_write_images?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试设置 tessedit_write_images
但似乎无法做到,我在任何地方都看不到 tessinput.tif
我在做:
导入tesseractapi = tesseract.TessBaseAPI()api.Init(".","eng",tesseract.OEM_TESSERACT_ONLY)api.SetPageSegMode(tesseract.PSM_AUTO_OSD)api.SetVariable("tessedit_write_images", "T")
但是我已经尝试过使用True"、1"和其他一些变体,但似乎根本不起作用.
有什么帮助吗?
解决方案
tessedit_write_images
在 Tesseract 的源代码中只检查一次(通过 TessBaseAPI::ProcessPage()
,见此处>..
所以你有两种方法:
- 调用
api.GetThresholdedImage()
,返回的图片就是设置变量后调用ProcessPage
保存的图片. - 只需调用
api.ProcessPage()
,它就会看到变量并输出tif.
I'm trying to set tessedit_write_images
but can't seem to do it, i can't see the tessinput.tif anywhere
i'm doing:
import tesseract
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_TESSERACT_ONLY)
api.SetPageSegMode(tesseract.PSM_AUTO_OSD)
api.SetVariable("tessedit_write_images", "T")
but i've tried with "True", "1", and some more variations, doesn't seem to work at all.
Any help?
解决方案
tessedit_write_images
is checked only once in Tesseract's source code (by TessBaseAPI::ProcessPage()
, see here).
So you have two ways:
- Call
api.GetThresholdedImage()
, and the returned image is what will be saved if you set the variable and callProcessPage
. - Just call
api.ProcessPage()
, and it will see the variable and output the tif.
这篇关于如何在 python-tesseract 中设置 tessedit_write_images?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文