为什么Tessnet2 OCR会给出不良结果

时间:2013-03-16 19:22:49

标签: vb.net ocr tessnet2

我正在使用tessnet2从.tif图像中获取文本。 例如,我想从图像中得到小数“700”,但我得到了这个:'Mupann' 我正在使用法语tessdata 这里是我正在使用的代码:

 ocr.SetVariable("tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,$-/#&=()\':?")
        ocr.Init(Application.StartupPath & "\tessdata", "fra", False)
        Dim result As List(Of tessnet2.Word) = ocr.DoOCR(captureTIF, Rectangle.Empty)

        For Each word As tessnet2.Word In result
            MsgBox(word.Confidence & " >> " & word.Text)
            RichTextBox1.Text &= word.Confidence & word.Text
        Next

由于

1 个答案:

答案 0 :(得分:0)

我不知道这对你的情况有帮助。但是当我使用TessNet2时,我使用布尔函数来确定某些单词。你会看到我有多个案例用于我正在寻找的单词。这不是我确定的最有效的方式,但它是单向的。

public Boolean isPageABSTRACTING(List<tessnet2.Word> wordList)
        {

            for (int i = 0; i < wordList.Count; i++) //scan through words
            {
                if ((wordList[i].Text == "Abstracting" || wordList[i].Text == "abstracting" || wordList[i].Text == "abstractmg" || wordList[i].Text == "Abstractmg" && wordList[i].Confidence >= 50) && (wordList[i + 1].Text == "Service" || wordList[i + 1].Text == "service" || wordList[i + 1].Text == "5ervice" && wordList[i + 1].Confidence >= 50) && (wordList[i + 2].Text == "Ordered" || wordList[i + 2].Text == "ordered" && wordList[i + 2].Confidence >= 50)) //find 1st tier check
                {
                    for (int j = 0; j < wordList.Count; j++) //scan through words again
                    {
                        if ((wordList[j].Text == "Due" || wordList[j].Text == "Oue" && wordList[j].Confidence >= 50) && (wordList[j + 1].Text == "Date" || wordList[j + 1].Text == "Oate" && wordList[j + 1].Confidence >= 50) && (wordList[j + 2].Text == "&" && wordList[j + 2].Confidence >= 50)) //find 2nd tier check
                        {
                            for (int h = 0; h < wordList.Count; h++) //scan through words again
                            {
                                if ((wordList[h].Text == "Additional" || wordList[h].Text == "additional" && wordList[h].Confidence >= 50) && (wordList[h + 1].Text == "comments" || wordList[h + 1].Text == "Comments" && wordList[h + 1].Confidence >= 50) && (wordList[h + 2].Text == "about" || wordList[h + 2].Text == "About" && wordList[h + 2].Confidence >= 50) && (wordList[h + 3].Text == "this" || wordList[h + 3].Text == "This" && wordList[h + 3].Confidence >= 50)) //find 3rd tier check
                                {
                                    return true;
                                }
                            }
                        }
                    }
                }
            }

            return false;
        }