tesseract没有得到标签 [英] tesseract didn't get the little labels

查看:98
本文介绍了tesseract没有得到标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've installed tesseract on my linux environment.

当我执行

# tesseract myPic.jpg /output

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

But my pic has some little labels and tesseract didn't see them.

是否可以使用一个选项来设置音高或类似的设置?

Is an option is available to set a pitch or something like that ?

文字标签示例:

在这张照片中,tesseract无法识别任何价值...

With this pic, tesseract doesn't recognize any value...

但是有这张照片:

我有以下输出:

J8

J7A-J7B P7 \

2
40 50 0 180 190

200

P1 P2 7

110 110
\ l

例如,在这种情况下,tesseract无法看到90(在左上方)...

For example, in this case, the 90 (on top left) is not seen by tesseract...

我认为这只是定义或类似想法的一种选择,不是吗?

I think it's just an option to define or somethink like that, no ?

Thx

推荐答案

为了从Tesseract(以及任何OCR引擎)获得准确的结果,您将需要遵循一些指导,这在我对本帖子的回答中可以看到: 使用Tesseract OCR和tess-two时的垃圾结果

In order to get accurate results from Tesseract (as well as any OCR engine) you will need to follow some guidelines as can be seen in my answer on this post: Junk results when using Tesseract OCR and tess-two

这是要点:

  • 使用高分辨率图像(如果需要),最低300 DPI

  • Use a high resolution image (if needed) 300 DPI is minimum

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

Make sure there is no shadows or bends in the image

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

If there is any skew, you will need to fix the image in code prior to ocr

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

Use a dictionary to help get good results

调整文本大小(理想的字体是12 pt)

Adjust the text size (12 pt font is ideal)

对图像进行二值化处理,并使用图像处理算法去除噪声

Binarize the image and use image processing algorithms to remove noise

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

It is also recommended to spend some time training the OCR engine to receive better results as seen in this link: Training Tesseract

我拍摄了您共享的2张图像,并使用 LEADTOOLS SDK 对它们进行了一些图像处理(免责声明:我是这家公司的雇员),与处理后的图像相比,您可以获得更好的结果,但是由于原始图像并不是最大的图像-仍然不是100%.这是我用来尝试修复图像的代码:

I took the 2 images that you shared and ran some image processing on them using the LEADTOOLS SDK (disclaimer: I am an employee of this company) and was able to get better results than you were getting with the processed images, but since the original images aren't the greatest - it still was not 100%. Here is the code I used to try and fix the images:

//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);
   }
}

这是此过程的输出图像:

Here are the output images from this process:

这篇关于tesseract没有得到标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆