在Tesseract PythonAPI上获取文本方向

2024-09-30 20:30:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Tesseract Python包装器来获取文本图像的方向。当我使用Tesseract OCR(而不是API)时,将模式设置为-psm 0可以工作,但我不知道如何在使用包装器时提取这些信息。 我看过文档,并尝试使用AnalyseLayout方法,但似乎找不到正确的方法。有什么想法吗??在

谢谢!在


Tags: 方法文档图像文本api信息模式方向
1条回答
网友
1楼 · 发布于 2024-09-30 20:30:21

下面是如何用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);
    }

相关问题 更多 >