OCR识别中的字符分割

来源:互联网 发布:别墅外观设计软件 编辑:程序博客网 时间:2024/05/22 16:51

OCR识别的一个重要环节是将连续的字符分割为若干个独立的字符区域。


1st 方法:

1) 二值化  2)闭运算 3)计算连通域 4)面积筛选  5)区域排序  

        不稳定因素:

       1)打印机油墨量多时,导致字符间距减少,闭运算效果达不到预期

       2)若字符部分像素面积较少,闭运算导致字符完整性被破坏


2nd 方法:

       1)二值化  2)将区域分割为若干个宽相等的矩形,halcon中的对应算子为partition_rectangle

      问题:字符所占宽度不相等


3rd 方法:

      1)二值化  2)将区域分割为若干个宽不等的矩形,halcon 中的对应算子为partition_dynamic  3)区域筛选

分割分为两步:

1)initial split positions are determined such that they are equally distributed over the horizontal extent of the input region, i.e., such that all the resulting parts would have the same width. For this, the number n of resulting parts is determined by dividing the width of the input region by Distance and rounding the result to the closest integer value. The distance between the initial split positions is now calculated by dividing the width of the input region by n. Note that the distance between these initial split positions is typically not identical to Distance. 

2)the final split positions are determined in the neighborhood of the initial split positions such that the input region is split at positions where it has the least vertical extent within this neighborhood. The maximum deviation of the final split position from the initial split position is Distance*Percent*0.01.

分割后,仍然存在干扰,通过区域像素面积筛选提出干扰区域,最终提取出单个字符有效区域。



4th 方法:

字符间隙的灰度值较高,计算垂直方向灰度投影值的一阶和二阶导数(gray_projection)。

问题:

测试时,此种方法不稳定,因为字符本身在纵向上的变化较多,有的字符较为接近,其间隙处与间隙两侧的灰度变化不明显。