使用OCR引擎tesseract无法理解提取文档中的坐标

shi*_*ail 4 ocr tesseract text-extraction hocr

我从tesseract中提取了一个图像文档并且已经提取成功了.但我无法理解提取文件的坐标.

问题描述: -

它显示坐标,但让我知道这些坐标代表像素或其他东西.这些是四个像title ="bbox 10 13 43 46",所以10,13 43和46是什么位置它们代表什么位置

提取后的完整代码

   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name='ocr-system' content='tesseract'/>
</head>
<body>
<div class='ocr_page' id='page_1' title='image "D:\ABC.tif"; bbox 0 0 464 101'>
    <div class='ocr_carea' id='block_1_1' title="bbox 10 13 330 55">
    <p 1class='ocr_par'>
        <span class='ocr_line' id='line_1_1' title="bbox 10 13 330 55">
            <span class='ocr_word' id='word_1_1' title="bbox 10 13 43 46">
                <span class='ocrx_word' id='xword_1_1' title="x_wconf -1"><strong>hi</strong></span>
            </span> 
            <span class='ocr_word' id='word_1_2' title="bbox 148 13 268 47">
                <span class='ocrx_word' id='xword_1_2' title="x_wconf -1"><strong>whats</strong></span>
            </span> 
            <span class='ocr_word' id='word_1_3' title="bbox 283 22 330 55">
                <span class='ocrx_word' id='xword_1_3' title="x_wconf -1"><strong>up</strong></span>
            </span>
        </span>
    </p>
    </div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Abd*_*eed 10

对于仍然想知道坐标系如何工作的人来说,我终于找到了它,就像这样

10 13 43 46 startx,starty,endx,endy

如果你想找到那个单词的宽度和高度

width = endx - startx,height = endy - starty

用''拆分字符串然后消除bbox然后你去..


hep*_*ish 5

也许这会在将来对某人有所帮助。我认为图像说明了一切。您可以根据这些值(例如height = y1-y0)计算高度或顶部距离(对于CSS) 在此处输入图片说明


jam*_*ono 4

这些数字应该显示一个盒子(一个矩形)的角的位置,其中有一个单词。

这就是hocr协议。

根据你的文档 tesseract 识别句子“嗨,怎么了”