OpenCV检测数字 [英] OpenCV detect numbers

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

问题描述

我在iPhone上使用OpenCV,需要检测图像中的数字。我将图像分割成较小的图像,因此每个图像只有一个数字(1-9)。所有数字都是打印的,不是手写的。

I'm using OpenCV on the iPhone and need to detect numbers in an image. I split the image into smaller images so each image has only one number (1-9). All numbers are printed, NOT handwritten.

用OpenCV计算出数字的最佳方法是什么?

What would be the best approach to figure out the numbers with OpenCV?

更新:

我已成功找到数字并将其解压缩。它们看起来像这样:

I have successfully found the numbers and extracted them. They look like this:

http ://img198.imageshack.us/img198/5671/101ht.jpg

http://img824.imageshack.us/img824/539/606yu.jpg

当他们被提取时他们在相同的大小等。我已经保存了一堆图像并将它们放在OCR目录中,在那里它们被分类为数字。喜欢:ocr / 1 / 100.jpg 101.jpg ....和ocr / 2 / 200.jpg 201.jpg ....

When they are extracted they are in the same size and so on. I have saved a bunch of images and put them in a OCR dir where they are categorized into numbers. Like: ocr/1/100.jpg 101.jpg.... and ocr/2/200.jpg 201.jpg....

然后我要去使用与Basic OCR教程相同的方法: http://blog.damiles.com/?p = 93

Then I was going to use the same approach as in the Basic OCR tutorial:http://blog.damiles.com/?p=93

但是,我正在为iPhone编程,不能使用C ++代码(编译时出错等)我没有访问highgui。

However, I'm programming for iPhone and can't use C++ code (error on compiling and so on) and I don't have access to highgui.

我尝试使用cvMatchTemplate()并匹配一堆图像,但它似乎工作得很糟糕......

I tried using cvMatchTemplate() and match a bunch of images but it seems to work pretty bad...

我可以尝试其他任何想法吗?

Any other ideas I can try?

推荐答案

您可以先阅读有关主成分分析(PCA)的内容,Fisher的线性判别分析(LDA)和支持向量机(SVM)。这些是对OCR非常有用的分类方法,并且有任何语言的库,包括C ++,Python,C#等。

You could start by reading about Principal Component Analysis (PCA), Fisher's Linear Discriminant Analysis (LDA), and Support Vector Machines (SVMs). These are classification methods that are extremely useful for OCR, and there are libraries in any language including C++, Python, C# etc.

事实证明,OpenCV已经包含了出色的实现在 PCA SVM 。我没有看到任何用于OCR的OpenCV代码示例,但您可以使用一些修改版的面部分类来执行字符分类。 OpenCV面部识别代码的优秀资源是此网站

It turns out that OpenCV already includes excellent implementations on PCAs and SVMs. I haven't seen any OpenCV code examples for OCR, but you can use some modified version of face classification to perform character classification. An excellent resource for face recognition code for OpenCV is this website.

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

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