为什么Tessnet2无法提取文本?

时间:2017-03-15 11:45:15

标签: tesseract tessnet2

我使用"tessnet2_64.dll" enter image description here

这是我的代码,提取文字:

 try
            {
                var image = new Bitmap(@"D:\Tessnet2\C#\test2.jpg");
                var ocr = new Tesseract();
               // ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
                //@"C:\OCRTest\tessdata" contains the language package, without this the method crash and app breaks
                ocr.Init(@"D:\Tessnet2\C#\tessdata", "eng", true); 
                var result = ocr.DoOCR(image, Rectangle.Empty);
                foreach (Word word in result)
                    Console.WriteLine("{0} : {1}", word.Confidence, word.Text);

                Console.ReadLine();
            }
            catch (Exception exception)
            {

            }

结果输出:

146: I-18110
47: 88

如何提取文字"Hello"? 谢谢大家。

1 个答案:

答案 0 :(得分:0)

我从以下地方得到了回复:

 ocr.Init(@"D:\Tessnet2\C#\tessdata", "eng", true); 

ocr.Init(@"D:\Tessnet2\C#\tessdata", "eng", false);