关于在黑板图像上使用 OCR 的建议

发布于 2024-09-01 17:07:41 字数 73 浏览 6 评论 0原文

我正在尝试获取可通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

勿忘初心 2024-09-08 17:07:41

您尝试过 OCR 软件吗? OCR 软件很可能非常适合读取本质上已经是黑白图像的图像。

但是,如果您需要这样做,您可以尝试:

  1. 对图像设置阈值。
    • 本质上是获取图像的灰度版本并将其转换为黑/白像素
    • 本质

  2. 执行二元扩张以增长剩余的对象
  3. 执行二元侵蚀

这个想法是通过扩张然后侵蚀,您将删除任何粗糙/嘈杂的边缘,然后您可以将骨架化图像传递给 OCR。

可能有很多方法可以达到类似的结果。鉴于有整本专门讨论计算机视觉的书籍,这个答案很难公正地对待它们。

我拥有的唯一文本是 1997 年的,但从那以后肯定有更多关于这个主题的文章。

  • 图像处理和计算机视觉算法 - JR Parker
  • 数字图像处理 - Gonzalez / Woods

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:

  1. Threshold the image.
    • Essentially take a greyscale version of the image and turn it into black / white pixels
  2. Perform Binary Dilation to grow the remaining objects
  3. Perform Binary Erosion

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.

  • Algorithms for Image Processing and Computer Vision - J.R. Parker
  • Digital Image Processing - Gonzalez / Woods
所有深爱都是秘密 2024-09-08 17:07:41

顺便说一句,我会说反转图像(反转颜色,以便文字是白底黑字)并稍微增加对比度。您可以尝试修改亮度,使擦除的粉笔雾消失在背景中。

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.

不羁少年 2024-09-08 17:07:41

在 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.

妄想挽回 2024-09-08 17:07:41

您是否尝试过边缘检测技术(例如 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.

不气馁 2024-09-08 17:07:41

不确定您在选择 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.

久而酒知 2024-09-08 17:07:41

有商业解决方案,但清理板图像似乎是一个开放问题。将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文