使用 OCR 识别上标字符 [英] Recognizing superscript characters using OCR

查看:93
本文介绍了使用 OCR 识别上标字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始了一个简单的项目,它必须获得一个包含带有上标的文本的图像,然后通过使用 OCR(目前我正在使用 tesseract)它必须识别上标字符 + 普通字符.

I've started a simple project in which it must get an image containing text with superscripts and then by using OCR (currently I'm using tesseract) it has to recognize the superscript characters + the normal ones.

例如,我们有一个化学方程式,例如 Cl²,但是当我使用 tesseract 识别它时,它给了我 Cl2(全部在一行中).

For example, we have a chemical equation such as Cl², but when I use the tesseract to recognize it, it gives me Cl2 (all in one line).

那么,这个问题的解决方案是什么?有没有其他可以读取上标的OCR API?

So, what is the solution for this problem? Is there any other OCR API that has the ability to read superscripts?

推荐答案

非常好的问题,涉及任何 OCR 系统的更高级功能.

Very good question that touches more advanced features of any OCR system.

首先,确保您不会忽略该功能,即使它可能存在于 OCR 系统中.确保不是以纯 TXT 格式查看您的结果测试,而是使用某种支持富文本的查看器.TXT 查看器(例如 Windows 上的记事本)通常不支持上标/下标字符,因此即使 OCR 为您提供正确的字符,您的查看器也可以将其转换为显示.如果您以编程方式访问文本结果,这不是问题,因为您应该在直接访问它时获得正确的下标字符值.请注意,观众必须支持它才能真正看到它.如果您消除了这种可能的后处理转换并确保 OCR 没有返回下标,那么它可能不支持它.

First of all, to make sure you are NOT overlooking the functionality even though it may be there on an OCR system. Make sure to look at your result test not in plain TXT format, but in some kind of rich text capable viewer. TXT viewers, such as Notepad on Windows, often do not support superscript/subscript characters, so even if OCR were to give you correct characters, your viewer could have converted it to display it. If you are accessing text result programatically, that is less of an issue because you are supposed to get a proper subscript character value when accessing it directly. Just note that viewers must support it for you to actually see it. If you eliminated this possible post-processing conversion and made sure that no subscript is returned from OCR, then it probably does not support it.

就像在这个文本框中一样,在您最初的问题中,您试图给我们一个上标字符示例,但是即使您可以从其他地方复制/粘贴它,这个文本框也不接受它.

Just like in this text box, in your original question you tried to give us a superscript character example, but this text box did not accept it even though you could copy/paste it from elsewhere.

许多 OCR 会将下标视为任何其他正常字符,如果他们能看到的话.您使用的 OCR 需要具备实际生成上标/下标的技术能力,而且其中很多都这样做,但它们往往是商业 OCR 系统也就不足为奇了.

Many OCR will see subscript as any other normal character, if they can see it at all. OCR of your use needs to have technical capability to actually produce superscripts/subscripts, and many of them do, but they tend to be commercial OCR systems not surprisingly.

在回答这封信之前,我做了一个小测试.我为我的测试生成了一个带有一些上标/下标示例的图像(当然 EMC2 是我想到的第一个示例:).
你可以在这里找到我的测试图片:www.ocr-it.com/documents/superscript_subscript_test_page.tif

I made a small testcase before answering this letter. I generated an image with a few superscript/subscript examples for my testing (of course EMC2 was the first example that came to mind :) .
You can find my test image here: www.ocr-it.com/documents/superscript_subscript_test_page.tif

并通过 OCR-IT OCR Cloud 2.0 API 使用所有默认设置处理此图像,但导出到富文本格式,例如 MS Word .DOC.

And processed this image through OCR-IT OCR Cloud 2.0 API using all default settings, but exporting to a rich text format, such as MS Word .DOC.

你可以在这里找到我的测试图片:www.ocr-it.com/documents/superscript_subscript_test_page_result.doc

You can find my test image here: www.ocr-it.com/documents/superscript_subscript_test_page_result.doc

另请注意:当您有兴趣提取上标/下标字符时,请单独注意您的图像质量,而不是典型文本.这些字符很小,您需要足够的细节和分辨率来实现下降 OCR 质量.由于像素太少,即使以 300 dpi 扫描图像有时也会出现小字符问题.如果您正在考虑移动和数码相机,这将变得更加重要.

Also note: When you are interested to extract superscript/subscript characters, pay separate attention to your image quality, more than you would with a typical text. Those characters are tiny and you need sufficient details and resolution to achieve descent OCR quality. Even scanned at 300 dpi images sometimes have issues with tiny characters due to too few pixels. If you are considering mobile and digital cameras, that becomes even more important.

披露:我的专长是为不同规模的公司实施内部 OCR 解决方案.我的公司是 WiseTREND.如果我需要进一步协助,请直接与我联系.

DISCLOSURE: My specialty is implementing internal OCR solutions for companies of different sizes. My company is WiseTREND. Contact me directly if I can assist with anything further.

这篇关于使用 OCR 识别上标字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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