Search code examples
tesseracttessnet2

Why Tessnet2 can't extract text?


I using "tessnet2_64.dll" enter image description here

This is my code , extract text:

 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)
            {

            }

Result Output:

146: I-18110
47: 88

How can extract text "Hello"? Thanks all.


Solution

  • I had resloved by changed from:

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

    to

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