关于在黑板图像上使用 OCR 的建议
我正在尝试获取可通过 OCR 读取的黑板图像。当然,大多数 OCR 软件都不喜欢脏图像。我应该尝试对图像进行什么图像处理来清理图像?
I'm trying to get an image of a blackboard readable by OCR. Naturally, most OCR software doesn't like dirty images. What image processing should I try to put the image through to clean the image up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您尝试过 OCR 软件吗? OCR 软件很可能非常适合读取本质上已经是黑白图像的图像。
但是,如果您需要这样做,您可以尝试:
本质
这个想法是通过扩张然后侵蚀,您将删除任何粗糙/嘈杂的边缘,然后您可以将骨架化图像传递给 OCR。
可能有很多方法可以达到类似的结果。鉴于有整本专门讨论计算机视觉的书籍,这个答案很难公正地对待它们。
我拥有的唯一文本是 1997 年的,但从那以后肯定有更多关于这个主题的文章。
Have you tried the OCR software yet? It's likely that the OCR software is well suited to reading what's essentially already a black and white image.
However, if you were required to do so you could try to:
The idea is by dilating then eroding you would remove any rough / noisy edges and then you can pass the skeletonized image to the OCR.
There are probably plenty of methods to achieve a similar result. Given that there are entire books devoted to computer vision this answer will hardly do them justice.
The only texts I have are from 1997, but surely there's been more written on the subject since.
顺便说一句,我会说反转图像(反转颜色,以便文字是白底黑字)并稍微增加对比度。您可以尝试修改亮度,使擦除的粉笔雾消失在背景中。
Offhand, I'd say invert the image (reverse the colors, so that the writing is black on white) and increase the contrast a bit. You can try modifying the brightness to get the erased chalk fogginess to disappear into the background.
在 Photoshop 中,色阶对话框可能是最有用的图像调整。在代码中模仿这一点完全是另一个主题。
级别的基础是调整亮度级别的最大、最小和中点。通常显示在直方图上,您可以调整点以获得所需的对比度,但也可以移动中点以使图像中的文本最清晰;对于 OCR 应用至关重要。通过移动中点,您可以通过使其消失到图像的亮(或暗)区域来“消除”通常围绕手写体的灰度模糊。
此外,您也可以尝试在进行此类调整后将图像转换为 1 位,将所有内容强制变为黑色或白色。有时这会加快 OCR 过程。但要小心,它也会丢弃细节。
In Photoshop, the Levels dialog may be your most useful image adjustment. Mimicking this in code is another subject, entirely.
The basis of Levels is that you adjust the max, min and midpoints of the brightness levels. Usually shown on a histogram, you adjust the points such that you obtain the desired amount of contrast, but also move the midpoint such that text in the image is the most well-defined; critical for OCR applications. By moving the midpoint you can "eliminate" the grayscale fuzz that ordinarily surrounds handwriting by causing it to disappear into the light (or dark) areas of the image.
Also you might try converting the image to 1-bit after such an adjustment, forcing everything to black or white. Sometimes this speeds up the OCR process. But be careful, it also will discard detail.
您是否尝试过边缘检测技术(例如 Roberts Cross 和 Sobel 算子)来滤除图像中的噪声?如果没有看到图像的质量,就无法说它的效果如何。
Have you tried edge detection techniques such as Roberts Cross and Sobel operator to filter noise out of the image? Without seeing the quality of the image, can't say how effective that'd be.
不确定您在选择 OCR 解决方案时受到多大限制,但 ABBYY OCR 引擎(以及基于它的 Web API,http://www.wisetrend.com/wisetrend_ocr_cloud.shtml )包括自动图像清理/纹理删除选项。
Not sure how constrained you are in the choice of OCR solution, but the ABBYY OCR engine (and a web API based on it, http://www.wisetrend.com/wisetrend_ocr_cloud.shtml ) includes automatic image cleanup / texture removal options.
有商业解决方案,但清理板图像似乎是一个开放问题。将 OCR 添加到未解决的问题中,您就会得到...一个未解决的问题。
There are commercial solutions but cleaning up board images appears to be an open problem. Add OCR to an unsolved problem, and you get... an unsolved problem.