tesseract没有获得小标签

Pau*_*aul 12 ocr tesseract

我已经在我的linux环境中安装了tesseract.

它在我执行类似的东西时有效

# tesseract myPic.jpg /output
Run Code Online (Sandbox Code Playgroud)

但我的照片有一些小标签,而tesseract没有看到它们.

有一个选项可用于设置音高或类似的东西吗?

文本标签示例:

在此输入图像描述

有了这张照片,tesseract不承认任何价值......

但有了这张照片:

在此输入图像描述

我有以下输出:

J8

J7A-J7B P7 \

2
40 50 0 180 190

200

P1 P2 7

110 110
\ l
Run Code Online (Sandbox Code Playgroud)

例如,在这种情况下,tesseract看不到90(左上角)......

我认为这只是一个选择来定义或想到这样的,不是吗?

谢谢

hch*_*am1 6

为了从Tesseract(以及任何OCR引擎)获得准确的结果,您需要遵循一些指导原则,如我在这篇文章中的答案所示: 使用Tesseract OCR和tess-two时的垃圾结果

以下是它的要点:

  • 使用高分辨率图像(如果需要)300 DPI是最小的

  • 确保图像中没有阴影或弯曲

  • 如果存在任何偏斜,则需要在ocr之前的代码中修复图像

  • 使用字典来帮助获得良好的结果

  • 调整文字大小(12磅字体是理想的)

  • 对图像进行二值化并使用图像处理算法来消除噪声

还建议花一些时间训练OCR引擎以获得更好的结果,如以下链接所示:Training Tesseract

我把你的共享和使用运行在他们的一些图像处理的2个图像LEADTOOLS SDK(免责声明:我是这个公司的员工),并能得到更好的结果比你用处理后的图像得到,但由于原图像不是最好的 - 它仍然不是100%.这是我用来尝试修复图像的代码:

//initialize the codecs class
using (RasterCodecs codecs = new RasterCodecs())
{
   //load the file
   using (RasterImage img = codecs.Load(filename))
   {
      //Run the image processing sequence starting by resizing the image
      double newWidth = (img.Width / (double)img.XResolution) * 300;
      double newHeight = (img.Height / (double)img.YResolution) * 300;
      SizeCommand sizeCommand = new SizeCommand((int)newWidth, (int)newHeight, RasterSizeFlags.Resample);
      sizeCommand.Run(img);

      //binarize the image
      AutoBinarizeCommand autoBinarize = new AutoBinarizeCommand();
      autoBinarize.Run(img);

      //change it to 1BPP
      ColorResolutionCommand colorResolution = new ColorResolutionCommand();
      colorResolution.BitsPerPixel = 1;
      colorResolution.Run(img);

      //save the image as PNG
      codecs.Save(img, outputFile, RasterImageFormat.Png, 0);
   }
}
Run Code Online (Sandbox Code Playgroud)

以下是此过程的输出图像:

image1已处理 image2已处理