0

I am trying to scan the numbers on screenshot but tesseract can read 2 number digit (ex.30,21,19) but it can not ready single digit (ex. 2,6,9) how can i fix that? I tried some solutions but i can not fix this problem.

private string FotoAnaliz()
{
    FileStream fs = new FileStream("D:\\program_goruntusuasıl.png", FileMode.OpenOrCreate);
    //string fotopath = @"D:\\program_goruntusu.jpg";
    Bitmap images = new Bitmap(fs);
    using (var engine = new TesseractEngine(@"./tessdata", "eng"))
    {
        engine.SetVariable("tessedit_char_whitelist", "0123456789");
        // have to load Pix via a bitmap since Pix doesn't support loading a stream.
        using (var image = new Bitmap(images))
        {
            using (var pix = PixConverter.ToPix(image))
            {
                using (var page = engine.Process(pix))
                {
                    sayı = page.GetText();
                    MessageBox.Show(sayı);
                    fs.Close();
                }
            }
        }
    }
    return sayı;
}
AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52
vaqol
  • 1

1 Answers1

0

Try this way, I wrote the answer here.

The problem can be solved temporarily by changing the mode to single line of text without searching pages and paragraphs.

using var engine= new TesseractEngine("LanguageDataFolder", "eng", EngineMode.Default);
engine.DefaultPageSegMode = PageSegMode.SingleBlock; // <= this line
Khai Vu
  • 1,280
  • 10
  • 9