Tesseract无法获取小标签。

12
我已经在我的 Linux 环境中安装了 Tesseract。
当我执行以下类似命令时,它可以正常工作:
# tesseract myPic.jpg /output

但是我的图片上有一些小标签,而tesseract没有识别到它们。

是否有可用的选项来设置音高或类似的东西?

文本标签示例:

enter image description here

使用这张图片,Tesseract 无法识别任何数值...
但是使用这张图片:

enter image description here

我有以下输出:

J8

J7A-J7B P7 \

2
40 50 0 180 190

200

P1 P2 7

110 110
\ l

例如,在这种情况下,tesseract无法识别左上方的90(即“90”未被tesseract识别...)。
我认为这只是定义选项之类的东西,不是吗?
谢谢
1个回答

6
为了从Tesseract(以及任何OCR引擎)获得准确的结果,您需要遵循一些指导方针,如我在此帖子中所述:使用Tesseract OCR和tess-two时出现垃圾结果
以下是要点:
  • 使用高分辨率图像(如果需要),最低300 DPI

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

  • 如果有任何倾斜,您需要在ocr之前在代码中修复图像

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

  • 调整文本大小(12pt字体最理想)

  • 将图像二值化并使用图像处理算法消除噪音

还建议花费一些时间训练OCR引擎以获得更好的结果,如此链接所示:培训Tesseract
我使用LEADTOOLS SDK对您分享的2张图像进行了一些图像处理(免责声明:我是该公司的员工),并且能够比您处理后得到更好的结果,但由于原始图像不是很好,因此仍然没有达到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);
   }
}

这是该过程的输出图像:

image1 processed image2 processed


谢谢回复,但为什么它无法识别所有标签,例如第二张图像左上角的90,它似乎很容易被读取。 - Paul
你可能需要对引擎进行训练,以获得更好的结果,或者使用更好的起始图像,这样就不必插值像素并调整大小。 - hcham1
什么是我这种情况下使用的最佳分割方法? - Paul
我认为在你的情况下,默认设置应该是最好的选择:https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality#page-segmentation-method - hcham1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接