【问题标题】:Character confidence for Tesseract 3.02 using config file使用配置文件的 Tesseract 3.02 的字符置信度
【发布时间】:2013-06-30 18:31:26
【问题描述】:

如何获得每个检测到的字符的置信度百分比? 通过搜索,我发现您应该将 save_blob_choices 设置为 T。 所以我将它作为一行添加到 tessdata/configs 的 hocr 配置文件中,并用它调用了 tesseract。 这就是我在生成的 html 文件中得到的全部内容:

<span class='ocr_line' id='line_1' title="bbox 0 0 50 17"><span class='ocrx_word' id='word_1' title="bbox 3 2 45 15"><strong>31,835</strong></span>

如您所见,没有任何置信度注释,甚至不是每个单词。

我没有 Visual Studio,因此无法进行任何代码更改。但我也愿意接受描述代码更改以及如何在没有 VS 的情况下编译代码的答案。

【问题讨论】:

    标签: ocr tesseract


    【解决方案1】:

    这是获取每个单词置信度的示例代码。 您甚至可以将 RIL_WORD 替换为 RIL_SYMBOL 以获得每个字符的信心。

    mTess.Recognize(0);
    tesseract::ResultIterator* ri = mTess.GetIterator();
    if(ri != 0)
    {
        do
        {
            const char* word = ri->GetUTF8Text(tesseract::RIL_WORD);
            if(word != 0 )
            {
                float conf = ri->Confidence(tesseract::RIL_WORD);
                printf("  word:%s, confidence: %f", word, conf );
            }
            delete[] word;
        } while((ri->Next(tesseract::RIL_WORD)));
    
        delete ri;
    }
    

    【讨论】:

      【解决方案2】:

      您必须编写一个程序来执行此操作。看看 Tesseract 网站上的ResultIterator API example。对于您的情况,请务必设置 save_blob_choices 变量并在 RIL_SYMBOL 级别进行迭代。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多