识别图像中的数字 [英] Recognize numbers in images

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

问题描述

我一直在寻找网上图片中数字识别的资源。我发现许多链接提供了关于该主题的大量资源。但不幸的是,它比帮助更令人困惑,我不知道从哪里开始。

I've been searching for resources for number recognition in images on the web. I found many links providing lots of resources on that topic. But unfortunately it's more confusing than helping, I don't know where to start.

我有一个包含5个数字的图像,没有受到干扰(没有验证码)或类似的东西)。这些数字在白色背景上是黑色的,用标准字体书写。

I've got an image with 5 numbers in it, non-disturbed (no captcha or something like this). The numbers are black on a white background, written in a standard font.

我的第一步是分开数字。我目前使用的算法非常简单,它只检查列是否完全是白色,因此是空格。然后它修剪每个角色,使其周围没有白色边框。这很有效。

My first step was to separate the numbers. The algorithm I currently use is quite simple, it just checks if a column is entirely white and thus a space. Then it trims each character, so that there is no white border around it. This works quite well.

但是现在我对这个数字的实际识别感到困惑。我不知道猜测正确方法的最佳方法是什么。我不认为直接比较字体是一个好主意,因为如果数字只有一点点差异,那就没有用了。

But now I'm stuck with the actual recognition of the number. I don't know what's the best way of guessing the correct one. I don't think directly comparing to the font is a good idea, because if the numbers only differ a little, it will no more work.

任何人都可以给我一个提示如何做到这一点?

Could anyone give me a hint on how this is done?

问题无关紧要,但我将用C#或Java实现。我发现了一些可以完成这项工作的库,但是我想自己实现它,以便学习一些东西。

It doesn't matter to the question, but I'll be implementing this in C# or Java. I found some libraries which would do the job, but I'd like to implement it myself, to learn something.

推荐答案

为什么不要使用像Tesseract这样的开源OCR引擎吗?

Why not look at using an open source OCR engine such as Tesseract?

http://code.google.com/p/tesseract-ocr/

Tesseract的C#Wrapper

http:/ /www.pixel-technology.com/freeware/tessnet2/

Tesseract的Java Wrapper

http://sourceforge.net/projects/tessocrinjava/

虽然你可能不会考虑使用第三方库来实现它,但是只需集成第三方工具就可以完成大量的工作。还要记住,看似简单的事情(识别数字5与数字6)通常非常复杂;我们谈论成千上万行代码复杂。至少,看一下tesseract的源代码,它会给你一个很好的理由想要利用第三方库。

While you might not consider using a third-party library as implementing it yourself, there's a tremendous amount of work that goes into just integrating the third-party tool. Keep in mind also that something that may seem simple (recognizing the number 5 versus the number 6) is often very complex; we're talking thousands and thousands of lines of code complex. In the least, look at the source code for tesseract and it'll give you a good reason to want to leverage a third-party library.

这是另一个SO问题,将给出一些关于所涉及的算法的想法: https://stackoverflow.com/questions / 850717 /什么是一些流行的ocr算法

Here's another SO question that'll give you some ideas about hte algorithms involved: https://stackoverflow.com/questions/850717/what-are-some-popular-ocr-algorithms

这篇关于识别图像中的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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