王海丰



摘 要: 光学字符识别(OCR)时,输出的文本行顺序需与实际的顺序相符。文章在字符Blob分析的基础上,对两个字符Blob外接矩形的相对位置关系进行划分,确定了各位置关系下同一文本行的判断方法,据此对排序后的字符Blob进行文本行初次生成和文本行二次合并,实现了任意方向文本行的生成。实际测试结果验证了所述方法生成任意方向文本行的有效性。
关键词: 光学字符识别; Blob分析; 外接矩形; 任意方向; 文本行
中图分类号:TP29 文獻标识码:A 文章编号:1006-8228(2022)03-11-03
Abstract: The output text line order from OCR (optical character recognition) process should be consistent with the actual order. On the basis of analyzing character Blob, this paper divides the relative position relationship of the bounding rectangle of the two characters Blob to determine the judgment method of the same text line under each position relationship. Then text lines are generated for the first time with the sorted character Blobs and merged for the second time, which realizes the arbitrary direction text line generation. The actual test results verify the effectiveness of the method.
Key words: optical character recognition; Blob analysis; bounding rectangle; arbitrary direction; text line
0 引言
Blob指图像中的一块连通区域,Blob分析是对前景/背景分离后的二值图像,进行连通域提取和标记。经过特定处理后,标记的每个Blob可以表示一个字符,可以计算字符图像的面积、质心、外接矩形等几何特征[1]。组成文本行的字符Blob及外接矩形如图1所示,绿色的矩形表示Blob的外接矩形[2],绿色外接矩形包围的白色像素表示字符的连通区域[3],多个字符Blob共同组成一个文本行。
光学字符识别(OCR)时,需要对图像做的预处理包括获取字符区域、图像二值化、倾斜校正、字符分割、字符识别等[4-5]。倾斜校正是图像处理中的重要步骤,对后续的字符分割、字符识别等均有影响。文本行所在的直线,能够有效表示出文本图像的旋转角度和倾斜程度,从而为倾斜校正提供所需的基本数据支持。光学字符识别的输出的结果,需要按照实际的段落和文本行进行组织[6-7]。因此,文本行生成,不仅是光学字符识别过程中必不可少的一个环节,而且是保证识别结果正确性的重要因素之一。……