基本像素/细胞计数算法
晚安 :)
我目前正在使用 DevIL 库,它允许我加载图像并检查每个像素的 RGB 值。 作为一个个人学习项目,我正在尝试为我自己在 Photoshop 中制作的几张图像编写一个非常基本的 OCR 系统。
我成功地消除了图像中的所有扭曲,留下了文本和数字。 我目前并不是在寻找从输入中学习的高级神经网络。 我想从相对简单的开始,因此我开始识别各个字符并计算这些字符中的像素。
我有两个问题:
- 识别单个字符。
- 最重要的是:我需要一种算法来计算连接的像素(相同颜色),而不需要计算我之前计算过的像素。 我没有数学背景,所以这对我来说是最大的问题。
感谢任何有关此事的帮助,谢谢。
编辑:
我已将这个问题标记为 C++,因为这是我当前正在使用的。 然而,来自另一种语言的伪代码或易于阅读的代码也可以。
Good night :)
I am currently playing with the DevIL library that allows me to load in image and check RGB values per pixel. Just as a personal learning project, I'm trying to write a very basic OCR system for a couple of images I made myself in Photoshop.
I am successfully able to remove all the distortions in the image and I'm left with text and numbers. I am currently not looking for an advanced neural network that learns from input. I want to start out relatively easy and so I've set out to identify the individual characters and count the pixels in those characters.
I have two problems:
- Identifying the individual characters.
- Most importantly: I need an algorithm to count connected pixels (of the same color) without counting pixels I've previously counted. I have no mathemathical background so this is the biggest issue for me.
Any help in the matter is appreciated, thanks.
edit:
I have tagged this question as C++ because that is what I am currently using. However, pseudo-code or easily readable code from another language is also fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只要您过滤了图像,洪水填充算法就可以计算包含的像素直至简单的黑色和黑色 白色位图。
话虽如此,您可以通过将每个字符与集合中每个字符的一组标准图像进行比较,测量相似度,然后选择得分最高的字符来执行字符识别。
请查看此问题了解更多信息。
The flood fill algorithm will work for counting the included pixels, as long as you have the images filtered down to simple black & white bitmaps.
Having said that, you can perform character recognition by comparing each character to a set of standard images of each character in your set, measuring the similarity, and then choosing the character with the highest score.
Take a look at this question for more information.
不确定这是否有帮助,但有一个名为 gocr 的 GPL OCR 库。
Not sure this helps, but there is a GPL OCR lib called gocr.
如果这离主题太远了,我深表歉意,但恕我直言 Vigra (不是另一个!)是一个比 DevIL 更好的 C++ 图像处理库。
Apologies if this is too far off-topic, but IMHO Vigra (not the other one!) is a much better image processing library for C++ than DevIL.