1

I'm using using tessnet2 to get text from a .tif image. For example i want to get the decimal '700' from the image but i'm getting this : 'Mupann' I'm using french tessdata Here the code that i'm using:

 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

Thanks

vertebre
  • 19
  • 4

1 Answers1

0

I dunno if this will help in your case. But when I used TessNet2 I used a Boolean function determine certain words. You'll see that I have multiple cases for the words I am looking for. This is NOTthe most efficient way I'm sure, but it's one way.

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;
        }
MaylorTaylor
  • 4,671
  • 16
  • 47
  • 76