Aspose 不检测数字

Aspose not detecting digits

我这辈子都无法检测到任何数字,我尝试了很多不同的解决方案,但 none 似乎有效。

这里有一个例子

如您所见,它看起来一点也不对。

我现在得到了代码(它在计时器上,所以提要是实时的):

 private void timer1_Tick(object sender, EventArgs e)
        {


            Image img = Clipboard.GetImage();

            pictureBox1.Image = img;
            ocr.Config.ProcessColoredBackground = true;


            if (img != null)
            {
                var ms = new MemoryStream();


                img.Save(ms, ImageFormat.Bmp); // put here the image format 
                ms.Position = 0;

                ocr.Image = ImageStream.FromStream(ms, ImageStreamFormat.Bmp);
                ocr.Config.RemoveNonText = true;
                ocr.Config.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.' };



                    if (ocr.Process()) // Start processing it 
                {
                    toolStripStatusLabel1.Text = "Text: " + ocr.Text;
                }
            }
        }

Aspose.OCR API 支持 Arial、Times New Roman、Courier New、Tahoma、Calibri 和 Verdana,采用黑色文本颜色和白色背景的常规、粗体和斜体样式。目前,Aspose.OCR 在彩色背景方面存在一些问题。 Aspose 团队正在研究此功能。你可以试试 Cloud version of Aspose.OCR.

我在 Aspose 工作,担任开发人员布道师。

如前所述,主要问题是黑底白字。 为了被正确识别,这些图像必须倒置。 该问题将在以后的 Aspose.OCR 版本中得到解决。