【发布时间】:2014-10-01 17:21:47
【问题描述】:
我正在使用 Tesseract Python Wrapper 来获取文本图像的方向。当我使用 Tesseract-OCR(不是 API)时,将模式设置为 -psm 0 有效,但我不知道如何在使用包装器时提取该信息。 我看过文档,我尝试使用方法 AnalyseLayout,但我似乎没有找到正确的方法。有什么想法吗??
谢谢!
【问题讨论】:
-
嗨,你能做到吗?怎么做到的?谢谢。
我正在使用 Tesseract Python Wrapper 来获取文本图像的方向。当我使用 Tesseract-OCR(不是 API)时,将模式设置为 -psm 0 有效,但我不知道如何在使用包装器时提取该信息。 我看过文档,我尝试使用方法 AnalyseLayout,但我似乎没有找到正确的方法。有什么想法吗??
谢谢!
【问题讨论】:
以下是如何在 Java 中执行此操作。我想 Python 应该是类似的。
IntBuffer orientation = IntBuffer.allocate(1);
IntBuffer direction = IntBuffer.allocate(1);
IntBuffer order = IntBuffer.allocate(1);
FloatBuffer deskew_angle = FloatBuffer.allocate(1);
int success = api.TessBaseAPIRecognize(handle, null);
if (success == 0) {
TessAPI.TessPageIterator pi = api.TessBaseAPIAnalyseLayout(handle);
api.TessPageIteratorOrientation(pi, orientation, direction, order, deskew_angle);
}
【讨论】: