了解弗里曼链codeS的OCR [英] Understanding Freeman chain codes for OCR

查看:156
本文介绍了了解弗里曼链codeS的OCR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意,我真的很想找一个回答我的问题。我的不可以寻找一个链接到一些源$ C ​​$ C或一些学术文章:我已经使用的源和我已经宣读论文,仍然没有想出最后对这个问题的一部分...

Note that I'm really looking for an answer to my question. I am not looking for a link to some source code or to some academic paper: I've already used the source and I've already read papers and still haven't figured out the last part of this issue...

我工作的一些快速的屏幕字体OCRing,我做了很好的进展。

I'm working on some fast screen font OCRing and I'm making very good progress.

我已经找到基线,分离的特点,转化为黑色和放大器的每个字符;白色,然后轮廓,以应用弗里曼链code将它的每个字符。

I'm already finding the baselines, separating the characters, transforming each character in black & white and then contouring each character in order to apply a Freeman chain code to it.

基本上它是一个8连接链code看起来像这样:

Basically it's an 8-connected chain code looking like this:

  3  2  1
   \ | /
  4-- --0
   / | \
  5  6  7

所以,如果我有一个'一',我所有的转换(包括转换为黑色和白色)后,我最终是这样的:

So if I have an 'a', after all my transformations (including transforming to black and white), I end up with something like this:

11110
00001
01111
10001
10001
01110

然后,它的外部countour可能看起来像这样(我的可以的在这里犯了一个错误,这是ASCII艺术轮廓和我的算法可以得到轮廓错误的,但是这不是我的问题点):

Then it's external countour may look like this (I may be making a mistake here, that's ASCII-art contouring and my 'algorithm' may get the contour wrong but that's not the point of my question):

 XXXX
X1111X
 XXXX1X
X01111X
X10001X
X10001X
 X111X
  XXX

继两个X,我得到的链code,这将是:

Following the Xs, I get the chain code, which would be:

0011222334445656677

0011222334445656677

请注意,这是标准化的连锁code,但你总是可以归链code是这样的:你只要保持最小整数

Note that that's the normalized chain code but you can always normalized a chain code like this: you just keep the smallest integer.

(顺便说一句,有一个超高效的执行,找到链条code,你只是需要一个'X'的8相邻像素,然后在256查询表看,如果你有0 ,1,2,3,4,5,6或7)

我现在的问题,却是:?从0011222334445656677链code,我怎么发现我有一个A

My question now, however, is: from that 0011222334445656677 chain code, how do I find that I have an 'a'?

由于,例如,如果我的'一'是这样的:

Because, for example, if my 'a' looks like this:

11110
00001
01111
10001
10001
01111  <-- This pixel is now full

然后,我的链code现在:0002222334445656677

Then my chain code is now: 0002222334445656677

然而,这也是一个'A'。

And yet this is also an 'a'.

我知道,这些链code整点是要抵御这种微小的变化,但我无法弄清楚如何我应该找哪个角色对应一个链条code

I know that the whole point of these chain code is to be resilient to such tiny changes but I can't figure out how I'm supposed to find which character corresponds to one chain code.

我去过那么远,现在我卡住了...

I've been that far and now I'm stuck...

(顺便说一句,我不需要100%的效率之类的东西区分从'O'或'O''0'是不是一个真正的问题)

推荐答案

你需要的是一个函数 D 测量链codeS之间的距离。在此之后发现这封信给定的链code是直截了当的:

What you need is a function d that measures the distance between chain codes. After then finding the letter to a given chain code is straightforward:

输入:

  • 在标准化连锁codeS 取值的一组可能的字母(通常是该隐codeS为包括AZ,az,0-9,...)
  • 链code X 一封信,需要检测,哪些可轻微变形(链code不匹配任何连锁$的C $ c在集取值
  • normalized chain codes S for the set of possible letters (generally the cain codes for A-Z, a-z, 0-9, ...)
  • chain code x of a letter which needs to be detected and which could be slightly deformed (the chain code wouldn't match any chain code in the set S)

该算法将遍历组可能的链codeS的和计算每个元件的距离 D(X,SI)。具有最小距离的信将是算法(所识别的字母)的输出

The algorithm would iterate through the set of possible chain codes and calculate the distance d(x,si) for each element. The letter with the smallest distance would be the output of the algorithm (the identified letter).

我建议以下的距离函数: 对于双链codeS,加起来每个方向的长度差异: D(X,SI)= | X0-的SiO | + | X1-SI1 | + ... + | X7-SI7 | X0 是0链中的code数 X 的SiO 是链code 0的个数 SI 等。

I would suggest following distance function: For two chain codes, add up the length differences of each direction: d(x,si) = |x0-si0| + |x1-si1| + .. + |x7-si7|. x0 is the number of 0s in the chain code x, si0 is the number of 0s in the chain code si, etc.

这是例子会更好地解释什么,我想。在下面的图像有字母8,B和D,第四信是一个稍有变形8,这需要被识别。这些信件都写有宋体与字体大小8.在图像中第二行是10倍放大,以更好地看到的像素。

An example will better explain what I'm thinking about. In the following image there are the letters 8, B and D, the fourth letter is a slightly deformed 8, which needs to be identified. The letters are written with Arial with font-size 8. The second line in the image is 10 times enlarged to better see the pixels.

我手动计算的(希望正确)的标准化连锁codeS它们是:

I manually calculated (hopefully correct) the normalized chain codes which are:

8:  0011223123344556756677
B:  0000011222223344444666666666
D:  00001112223334444666666666
8': 000011222223344556756666 (deformed 8)

长度差异(绝对伏特加)是:

The length differences (absolut) are:


direction | length         | difference to 8'
          | 8 | B | D |  8'|   8 |  B |  D |
----------+---+---+---+----+-----+----+-----
        0 | 2 | 5 | 4 |  4 |   2 |  1 |  0 |
        1 | 3 | 2 | 3 |  2 |   1 |  0 |  1 |
        2 | 3 | 5 | 3 |  5 |   2 |  0 |  2 |
        3 | 3 | 2 | 3 |  2 |   1 |  0 |  1 |
        4 | 2 | 5 | 4 |  2 |   0 |  3 |  2 |
        5 | 3 | 0 | 0 |  3 |   0 |  3 |  3 |
        6 | 3 | 9 | 9 |  5 |   2 |  4 |  4 |
        7 | 3 | 0 | 0 |  1 |   2 |  1 |  1 |
----------+---+---+---+----+-----+----+-----
                        sum   10 | 12 | 14 |

8已链code 8 的最小距离,因此算法将确定信 8 。信 B 的距离并不大很多,但这是因为变形8看起来几乎像 B

8' has the smallest distance to the chain code of 8, thus the algorithm would identify the letter 8. The distance to the letter B is not much bigger, but this is because the deformed 8 looks almost like the B.

此方法不结垢不变。我认为有两种选择解决这个问题:

This method is not scaling invariant. I think there are two options to overcome this:

  • 对于不同的字体大小,具有不同套标准化连锁codeS的
  • 在一组标准化的连锁codeS的大尺寸(例如35x46像素)及标度输入字母(其中待确定),以这个大一号的。

我不太清楚,如果距离函数是对集合的所有字母数字字母不够好,但我希望是这样。要确定一个字母,您可以包括等功能最大限度地减少误差(不仅是连锁codeS)进入分类步骤。再次,你需要一个距离度量 - 这一次的特征向量。

I'm not quite sure if the distance function is good enough for the set of all alphanumeric letters but I hope so. To minimize the error in identifying a letter you could include other features (not only chain codes) into the classification step. And again, you would need a distance measure -- this time for feature vectors.

这篇关于了解弗里曼链codeS的OCR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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