CN101408937B - Character line positioning method and device - Google Patents
Character line positioning method and device Download PDFInfo
- Publication number
- CN101408937B CN101408937B CN2008102171998A CN200810217199A CN101408937B CN 101408937 B CN101408937 B CN 101408937B CN 2008102171998 A CN2008102171998 A CN 2008102171998A CN 200810217199 A CN200810217199 A CN 200810217199A CN 101408937 B CN101408937 B CN 101408937B
- Authority
- CN
- China
- Prior art keywords
- candidate characters
- inclination
- angle
- information
- character
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000013139 quantization Methods 0.000 claims description 10
- 238000004458 analytical method Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000007619 statistical method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Images
Landscapes
- Character Input (AREA)
Abstract
Description
技术邻域technology neighborhood
本发明涉及图像处理邻域,尤其涉及一种字符行定位的方法及装置。The invention relates to the field of image processing, in particular to a method and device for character row positioning.
背景技术 Background technique
在自动字符识别技术中,将需要识别的字符精确定位是整个识别技术的一个难点和关键点。一个完整的字符识别过程,如对票据的磁码字符行中的字符识别的过程,通常包括:对待识别字符区域(如磁码字符行)二值化,对待识别的字符区域进行进一步定位,根据定位结果将待识别字符区域切分出来,将切分出来的字符区域进行特征提取和识别,如图1所示。而定位对后续切分、特征提取以及识别的精度有着至关重要的影响。In the automatic character recognition technology, it is a difficulty and a key point of the whole recognition technology to accurately locate the character to be recognized. A complete character recognition process, such as the process of character recognition in the magnetic code character line of the bill, usually includes: binarization of the character area to be recognized (such as the magnetic code character line), further positioning of the character area to be recognized, according to The positioning results segment the character area to be recognized, and perform feature extraction and recognition on the segmented character area, as shown in Figure 1. Positioning has a crucial impact on the accuracy of subsequent segmentation, feature extraction, and recognition.
传统的磁码字符行中的字符识别中的定位方式主要分为空间投影法与空间聚类法两种。与普通的字符识别的定位区别的是,磁码字符行中的字符是排列成行的,而且通常只有一行或几行,所以定位的范围具有明显的区域特征。而空间投影法正是利用磁码字符行在水平方向上投影分量较大的特点,选取适当阈值确定磁码字符行在垂直方向上的空间位置;空间聚类法以连通域标记为基础,考察候选字符中心在垂直y轴方向上的密集程度,以此来定位磁码字符行位置。The positioning methods in character recognition in the traditional magnetic code character line are mainly divided into two types: spatial projection method and spatial clustering method. The difference from the positioning of ordinary character recognition is that the characters in the magnetic code character line are arranged in rows, and usually there are only one or several lines, so the positioning range has obvious regional characteristics. The spatial projection method utilizes the feature that the magnetic code character line has a relatively large projection component in the horizontal direction, and selects an appropriate threshold to determine the vertical spatial position of the magnetic code character line; the spatial clustering method is based on connected domain marks. The density of candidate character centers in the vertical y-axis direction is used to locate the magnetic code character row position.
但是,在实现本发明过程中,发明人发现空间投影法虽然定位速度快,对倾斜的磁码字符行检测有一定鲁棒性,但是其抗噪能力不够,尤其是在搜索区域中出现黑带或黑块的情况下很可能会导致定位失败;而空间聚类法虽然具有良好的抗噪能力,但对于出现一定程度倾斜的磁码字符行,由于各字符的中心位置在垂直方向偏离较大,所以检测效果不佳。However, in the process of realizing the present invention, the inventors found that although the space projection method has a fast positioning speed and has certain robustness to the detection of inclined magnetic code character lines, its anti-noise ability is not enough, especially when black bands appear in the search area. In the case of a black block or a black block, it is likely to cause positioning failure; although the spatial clustering method has good anti-noise ability, for a magnetic code character row with a certain degree of inclination, since the center position of each character deviates greatly in the vertical direction , so the detection effect is not good.
发明内容 Contents of the invention
本发明所要解决的技术问题在于,提供一种字符行定位的方法及装置。可在即保证具有较好的抗噪能力,同时准确定位具有一定程度倾斜的字符行。The technical problem to be solved by the present invention is to provide a method and device for character line positioning. It can immediately ensure a good anti-noise ability, and at the same time accurately locate the character line with a certain degree of inclination.
为此,一方面,本发明的实施例提供了一种字符行定位的方法,方法包括:For this reason, on the one hand, the embodiment of the present invention provides a kind of method of character line location, and method comprises:
根据待处理图像数据获得候选字符信息,所述候选字符信息中包括候选字符数目达到一定数目的所述图像数据的区域;Obtaining candidate character information according to the image data to be processed, wherein the candidate character information includes regions of the image data whose number of candidate characters reaches a certain number;
获取所述候选字符信息中候选字符的位置信息,所述位置信息包括所述候选字符的中心坐标;Acquire position information of candidate characters in the candidate character information, where the position information includes the center coordinates of the candidate characters;
根据所述候选字符的位置信息获得符合所述候选字符的邻域范围条件的其他候选字符的位置信息,所述邻域范围条件包括在所述候选字符中心坐标的一定空间距离范围内;Obtaining position information of other candidate characters that meet the neighborhood range condition of the candidate character according to the position information of the candidate character, the neighborhood range condition being included within a certain spatial distance range of the center coordinates of the candidate character;
根据所述候选字符的位置信息和所述其他候选字符的位置信息获取所述字符间倾斜角度信息;Acquiring the inter-character inclination angle information according to the position information of the candidate characters and the position information of the other candidate characters;
根据所述字符间倾斜角度信息确定所述候选字符的字符行的边界框,以完成定位。Determine the bounding box of the character line of the candidate character according to the inter-character inclination angle information, so as to complete the positioning.
另一方面,本发明的实施例提供了一种字符行定位的装置,包括:On the other hand, an embodiment of the present invention provides a device for character line positioning, including:
字符信息获取单元,用于根据待处理图像数据获得候选字符信息,所述候选字符信息中包括候选字符数目达到一定数目的所述图像数据的区域;A character information acquisition unit, configured to obtain candidate character information according to the image data to be processed, the candidate character information including areas of the image data where the number of candidate characters reaches a certain number;
第一位置信息模块,用于获取所述候选字符信息中候选字符的位置信息,所述位置信息包括所述候选字符的中心坐标;A first position information module, configured to acquire position information of candidate characters in the candidate character information, where the position information includes the center coordinates of the candidate characters;
第二位置信息模块,用于根据所述候选字符的位置信息获得符合所述候选字符的邻域范围条件的其他候选字符的位置信息,所述邻域范围条件包括在所述候选字符中心坐标的一定空间距离范围内;The second position information module is used to obtain the position information of other candidate characters that meet the neighborhood range conditions of the candidate characters according to the position information of the candidate characters, and the neighborhood range conditions include the coordinates of the center coordinates of the candidate characters within a certain distance;
倾斜度信息模块,用于根据所述候选字符的位置信息和所述其他候选字符的位置信息获取所述字符间倾斜角度信息;an inclination information module, configured to acquire the inter-character inclination angle information according to the position information of the candidate characters and the position information of the other candidate characters;
定位单元,用于根据所述字符间倾斜角度信息确定所述候选字符的字符行的边界框,以完成定位。The positioning unit is configured to determine the bounding box of the character line of the candidate character according to the inter-character inclination angle information, so as to complete the positioning.
在本发明实施例所采用的技术方案中,在进行定位时,还根据候选字符信息获取字符间倾斜角度信息,从而可以在保证较好的抗噪力的前提下,准确定位具有一定倾斜度的字符行。In the technical solution adopted in the embodiment of the present invention, when positioning, the inclination angle information between characters is also obtained according to the candidate character information, so that the character with a certain inclination can be accurately positioned on the premise of ensuring better noise resistance. character line.
附图说明 Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本邻域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1是现有的自动字符识别技术的流程示意图;Fig. 1 is the schematic flow chart of existing automatic character recognition technology;
图2是本发明实施例中的字符行定位的方法的一个具体流程示意图;Fig. 2 is a specific schematic flow chart of the method for character line positioning in the embodiment of the present invention;
图3是本发明实施例中的字符行定位的方法的另一个具体流程示意图;Fig. 3 is another specific flowchart of the method for character line positioning in the embodiment of the present invention;
图4是需要进行定位的图像示意图;Fig. 4 is a schematic diagram of an image that needs to be positioned;
图5是定位的结果示意图;Fig. 5 is a schematic diagram of the result of positioning;
图6是本发明实施例中的字符行定位的装置的一个具体组成示意图;FIG. 6 is a schematic diagram of a specific composition of the character line positioning device in the embodiment of the present invention;
图7是图6中的倾斜度获取单元的一个具体组成示意图;Fig. 7 is a schematic diagram of a specific composition of the inclination acquisition unit in Fig. 6;
图8是图6中的定位单元的一个具体组成示意图;Fig. 8 is a schematic diagram of a specific composition of the positioning unit in Fig. 6;
图9是图6中的定位单元的另一个具体组成示意图。FIG. 9 is a schematic diagram of another specific composition of the positioning unit in FIG. 6 .
具体实施方式 Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本邻域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
下面参考附图对本发明的实施例进行描述。参见图2,为本发明实施例中的字符行定位的方法的一个具体流程示意图。该流程包括:Embodiments of the present invention will be described below with reference to the accompanying drawings. Referring to FIG. 2 , it is a schematic flow chart of a method for character line positioning in an embodiment of the present invention. The process includes:
201、根据待处理图像数据获得候选字符信息。具体可以包括,对所述待处理图像数据进行二值化,获得二值图;对所述二值图进行连通域分析获得候选字符信息,如对二值图进行连通域标记,将符合条件的连通分量作为候选字符,并计算该候选字符的中心坐标。也可以不对待处理图像进行二值化,而是直接在灰度图或彩色图上利用灰度或色彩等信息获得候选字符信息。201. Obtain candidate character information according to image data to be processed. Specifically, it may include performing binarization on the image data to be processed to obtain a binary image; performing connected domain analysis on the binary image to obtain candidate character information, such as performing connected domain marking on the binary image, and selecting qualified Connected components are used as candidate characters, and the center coordinates of the candidate characters are calculated. It is also possible not to perform binarization on the image to be processed, but to directly use information such as grayscale or color on the grayscale image or color image to obtain candidate character information.
其中,所述候选字符可以包括多个,如,当获得的候选字符数目到达一定数目后确定需要进行定位并执行后续步骤,否则改变获取图像数据的区域,重新获取图像数据。Wherein, the candidate characters may include multiple characters. For example, when the number of candidate characters obtained reaches a certain number, it is determined that positioning is required and subsequent steps are performed; otherwise, the image data acquisition area is changed and the image data is acquired again.
202、根据所述候选字符信息获得字符间倾斜角度信息,所述字符间倾斜角度信息用于标识候选字符与所述候选字符的邻域候选字符的位置关系。具体可包括:202. Obtain inter-character inclination angle information according to the candidate character information, where the inter-character inclination angle information is used to identify a positional relationship between a candidate character and a neighboring candidate character of the candidate character. Specifically, it may include:
A、获取所述候选字符信息中候选字符的位置信息,如候选字符的中心坐标;A. Obtain the position information of the candidate characters in the candidate character information, such as the center coordinates of the candidate characters;
B、根据所述候选字符的位置信息获得符合所述候选字符的邻域范围条件的其他候选字符的位置信息,如根据上述候选字符的中心坐标计算在该坐标的一定空间距离范围内的其他邻近的候选字符。即该邻域范围为基于空间度量距离的邻域范围,如基于欧氏距离的环状邻域范围、或是基于街区距离的邻域范围、或是基于其他的距离计算方法的邻域范围。B. According to the position information of the candidate characters, obtain the position information of other candidate characters that meet the neighborhood range conditions of the candidate characters, such as calculating other neighbors within a certain spatial distance of the coordinates according to the center coordinates of the above-mentioned candidate characters candidate characters. That is, the neighborhood range is a neighborhood range based on spatial measurement distance, such as a circular neighborhood range based on Euclidean distance, or a neighborhood range based on block distance, or a neighborhood range based on other distance calculation methods.
C、根据所述候选字符的位置信息和所述其他候选字符的位置信息获取所述字符间倾斜角度信息。C. Obtain the inter-character inclination angle information according to the position information of the candidate characters and the position information of the other candidate characters.
203、根据所述字符间倾斜角度信息确定所述候选字符的字符行的边界框,以完成定位。其中,字符间倾斜角度信息包括字符间倾斜角度;边界框可以是矩形框。203. Determine a bounding box of a character line of the candidate character according to the inter-character inclination angle information, so as to complete positioning. Wherein, the inter-character inclination angle information includes inter-character inclination angle; the bounding box may be a rectangular box.
具体可以是根据统计的方法确定倾斜角度,如:获得与所述候选字符有关的至少一个字符间倾斜角度;对各所述字符间倾斜角度的取值范围进行量化;统计获得落入各量化区间内的字符间倾斜角度的数目;根据统计获得各量化区间的所述数目确定字符行倾斜角度;根据所述字符行倾斜角度确定候选字符的边界框,即根据上述确定的所述字符行倾斜角度及其所对应的字符空间位置信息确定候选字符的字符行的边界。Specifically, the inclination angle can be determined according to a statistical method, such as: obtaining at least one inter-character inclination angle related to the candidate character; quantifying the value range of the inclination angle between each of the characters; statistically obtaining the inclination angle falling into each quantization interval The number of inclination angles between characters within; obtain the said number of quantization intervals according to statistics to determine the character row inclination angle; determine the bounding box of the candidate character according to the character row inclination angle, that is, determine the character row inclination angle according to the above The character space position information corresponding to it determines the boundary of the character line of the candidate character.
也可以是根据聚类的方法确定倾斜角度,如:获得与所述候选字符有关的至少一个字符间倾斜角度;根据各所述字符间倾斜角度进行聚类,以聚类获得的类别中心作为确定的字符行倾斜角度;根据确定的所述字符行倾斜角度确定候选字符的字符行的边界框。It is also possible to determine the inclination angle according to the method of clustering, such as: obtain at least one inter-character inclination angle related to the candidate characters; perform clustering according to each of the inter-character inclination angles, and use the category center obtained by clustering as a determination The inclination angle of the character row; determine the bounding box of the character row of the candidate character according to the determined inclination angle of the character row.
如图3所示,为应用到对票据的磁码字符行进行定位时,本发明实施例中的字符行定位的方法的具体流程示意图。该流程包括:As shown in FIG. 3 , it is a schematic flowchart of a method for locating a character line in an embodiment of the present invention when applied to locating a character line of a magnetic code of a bill. The process includes:
301、选取整个票据图像中的部分区域作为定位搜索的区域,然后对该区域中的图像数据进行二值化,获得二值图。通常票据中的磁码字符行都在票据的下方,因此,可以选取票据图像中下方部分(如下方1/5)区域作为搜索区域。301. Select a partial area in the entire bill image as an area for positioning search, and then perform binarization on the image data in the area to obtain a binary image. Usually the magnetic code character lines in the bill are all under the bill, therefore, the lower part (such as the lower 1/5) area of the bill image can be selected as the search area.
302、对上步中获得的二值图进行连通域分析,根据分析结果进行连通域标记,以记录各连通分量的位置及大小。如,可以根据快速区域标号算法进行连通域分析。302. Perform connected domain analysis on the binary image obtained in the previous step, and mark the connected domain according to the analysis result, so as to record the position and size of each connected component. For example, connected domain analysis can be performed according to the fast region labeling algorithm.
303、在经过连通域标记的二值图中,根据预定的宽高(或宽高范围)选取符合磁码字符宽高条件的连通分量作为候选字符。如,根据一些先验信息确定预定的宽高或宽的高范围来确定候选字符,即事先知道所要定位的某种字符的大小范围应该是宽度与高度在多少个像素至多少个像素之间。303. In the binary graph marked with connected domains, select connected components that meet the width and height conditions of the magnetic code characters as candidate characters according to a predetermined width and height (or width and height range). For example, determine a predetermined width and height or a width and height range according to some prior information to determine candidate characters, that is, it is known in advance that the size range of a certain character to be positioned should be between the number of pixels and the number of pixels between the width and height.
304、统计候选字符的总数量是否大于预定数量,若候选字符的数量大于预定数量,则认为磁码字符行存在,执行305步;否则,则认为磁码字符行不存在,退出定位,或是退出本次定位,重新执行步骤301,选取下一搜索区域进行定位,直至搜索完成。304, count whether the total number of candidate characters is greater than the predetermined number, if the number of candidate characters is greater than the predetermined number, then consider that the magnetic code character row exists, and perform
305、计算所有候选字符的中心坐标。305. Calculate the center coordinates of all candidate characters.
306、根据候选字符的中心坐标计算字符间倾斜角度。如,计算连接每个候选字符的中心坐标与其邻域范围内的各候选字符的中心坐标的连线的角度,其中,邻域范围可以是基于欧氏距离的范围,例如,设候选字符的中心坐标为(x0,y0),则以其为中心的基于欧氏距离的邻域范围可定义为:306. Calculate an inter-character inclination angle according to the center coordinates of the candidate characters. For example, calculate the angle of the line connecting the center coordinates of each candidate character and the center coordinates of each candidate character in its neighborhood, where the neighborhood range can be a range based on Euclidean distance, for example, if the center of the candidate character The coordinates are (x 0 , y 0 ), then the neighborhood range based on Euclidean distance centered on it can be defined as:
RingNeibour(x0,y0)={(x,y)|T1<f(x,y,x0,y0)<T2} (式1)RingNeibour(x 0 , y 0 )={(x, y)|T1<f(x, y, x 0 , y 0 )<T2} (Formula 1)
其中,T1可取候选字符平均宽度的三至四倍,T2取候选字符平均宽度的五至六倍。满足上述邻域范围定义的候选字符,则选为邻域候选字符计算倾斜角度。Wherein, T1 may take three to four times the average width of candidate characters, and T2 may take five to six times the average width of candidate characters. Candidate characters satisfying the above definition of the neighborhood range are selected as neighborhood candidate characters to calculate the tilt angle.
其中,上述邻域范围也可以是基于其他的举例定义方式,例如街区距离等等。即,式2中的距离公式还可定义为:Wherein, the above-mentioned neighborhood range may also be based on other example definition methods, such as block distance and the like. That is, the distance formula in
距离公式1:f(x,y,x0,y0)=|x-x0|+|y-y0|Distance formula 1: f(x, y, x 0 , y 0 )=|xx 0 |+|yy 0 |
距离公式2:f(x,y,x0,y0)=Max(|x-x0|,y-y0|)Distance formula 2: f(x, y, x 0 , y 0 )=Max(|xx 0 |, yy 0 |)
距离公式3:f(x,y,x0,y0)=Min(|x-x0|,y-y0|)Distance formula 3: f(x, y, x 0 , y 0 )=Min(|xx 0 |, yy 0 |)
……...
对各个候选字符,或是根据规则选取部分的候选字符,分别计算其与邻域范围内的各候选字符的字符间倾斜角度。由于上述计算获得多个倾斜角度可能不尽相同,需要统计得到一个最接近真实值的倾斜角度。具体可以采用多种概率统计的方法。For each candidate character, or part of the candidate characters selected according to the rules, the inter-character inclination angles between it and each candidate character in the neighborhood are calculated respectively. Since the multiple inclination angles obtained by the above calculation may be different, it is necessary to obtain an inclination angle closest to the real value through statistics. Specifically, various probability and statistics methods can be used.
对统计的方法举例如下:确定一个倾斜角度的可能范围,如确定为[-Max,Max],其中Max取值为10,对这个角度范围进行量化,量化阶长t值为0.1,统计上述得到的多个倾斜角度中落入各个量化阶内的数目,并确定落入的倾斜角度的数目最大的量化阶对应的角度为磁码字符行的倾斜角度。The statistical method is exemplified as follows: determine the possible range of an inclination angle, such as being determined as [-Max, Max], wherein the value of Max is 10, quantify this angle range, and the quantization step length t value is 0.1, and the above statistics are obtained The number of multiple inclination angles that fall into each quantization step, and determine the angle corresponding to the quantization step with the largest number of inclination angles to be the inclination angle of the magnetic code character row.
如,可如上所述的范围和量化阶定义一个角度计数器,统计各个倾斜角度,若角度值落在计数器的某个阶区内,对应阶区的计数自增一个单位,并同时记录该角度值所对应的候选字符的信息(如候选字符的编号),统计出具有最大计数单位的角度,若计数值小于某个阈值,认为磁码字符行不存在,退出;否则,认为该角度为磁码字符行倾斜角度。For example, an angle counter can be defined with the above-mentioned range and quantization order to count each tilt angle. If the angle value falls within a certain step area of the counter, the count of the corresponding step area will be incremented by one unit, and the angle value will be recorded at the same time The information of the corresponding candidate character (such as the number of the candidate character), count the angle with the largest counting unit, if the count value is less than a certain threshold, it is considered that the magnetic code character line does not exist, and exit; otherwise, the angle is considered to be the magnetic code Character line tilt angle.
也可以采用聚类的方法确定倾斜角度,如,对所有的角度值进行聚类,以聚类得到的最大类别的中心对应的倾斜角度作为磁码字符行的倾斜角度,即通过聚类所找到的角度类别中挑出一个具有最大计数的类别,并把该类别中心的角度值作为最终结果。。如在如下聚类空间中进行聚类:聚类空间有两个坐标轴,横轴反映角度值信息,纵轴反映角度值对应的计数。具体的聚类方法可以采用kmeans(k均值)聚类、ISODATA聚类等多种聚类算法。Also can adopt the method of clustering to determine inclination angle, as, all angle values are clustered, and the inclination angle corresponding to the center of the largest category obtained by clustering is used as the inclination angle of the magnetic code character line, that is, found by clustering Pick a category with the largest count among the angle categories of , and take the angle value of the center of the category as the final result. . For example, clustering is performed in the following clustering space: the clustering space has two coordinate axes, the horizontal axis reflects the angle value information, and the vertical axis reflects the count corresponding to the angle value. The specific clustering method can use various clustering algorithms such as kmeans (k-means) clustering and ISODATA clustering.
307、根据确定的字符行的倾斜角度,利用最小二乘法拟合该角度值对应的候选字符的字符行的上界线与下界线,完成定位。307. According to the determined inclination angle of the character row, use the least squares method to fit the upper boundary line and the lower boundary line of the character row of the candidate character corresponding to the angle value, and complete the positioning.
在本发明实施例所提供的方案中,根据磁码字符行的空间排列特点(磁码字符中心基本在一条直线上分段紧密排列),利用计算出的候选字符何其邻域字符之间的倾斜角度推定磁码字符行的倾斜角度,从而准确地定位具有一定倾斜角度的磁码字符行。其中,在确定磁码字符行的倾斜角度时,采用各个角度投票的方式计算整个磁码字符行的倾斜角度,提高了倾斜度确定的稳定性。In the scheme provided by the embodiment of the present invention, according to the spatial arrangement characteristics of the magnetic code character row (the center of the magnetic code character is basically closely arranged in segments on a straight line), the calculated candidate character and the inclination between the adjacent characters are used The angle estimates the inclination angle of the character row of the magnetic code, so as to accurately locate the character row of the magnetic code with a certain inclination angle. Wherein, when determining the inclination angle of the character row of the magnetic code, the inclination angle of the entire character row of the magnetic code is calculated by voting at each angle, which improves the stability of determining the inclination.
同时,为了避免因为相邻磁码字符间距离太近,不能真实反映磁码字符行的偏转情况,所以对每个磁码字符考察与其环状邻域磁码字符的偏转情况,这样得到的各字符间的倾斜角度能更真实的反映整个磁码字符行的倾斜程度。提高了定位的稳定性和准确性。At the same time, in order to avoid the fact that the distance between adjacent magnetic code characters is too close, the deflection of the magnetic code character row cannot be truly reflected, so the deflection of each magnetic code character and its ring-shaped adjacent magnetic code characters is investigated. The inclination angle between characters can more truly reflect the inclination degree of the entire magnetic code character row. Improved positioning stability and accuracy.
如图4和图5所示,为采用本发明实施例中的方案的对实际票据进行定位的情况。图4中为需要进行定位的图像。图5中矩形框即为定位的结果。可见对于这种图像中磁码字符行倾斜的情况,采用本发明实施例中的方案仍可以准确的进行定位。As shown in Fig. 4 and Fig. 5, it is the situation of positioning the actual bill by adopting the solution in the embodiment of the present invention. Figure 4 shows the images that need to be positioned. The rectangular frame in Fig. 5 is the result of positioning. It can be seen that for the case where the magnetic code character line in the image is tilted, the solution in the embodiment of the present invention can still be accurately positioned.
相应的,本发明实施例还提供了一种字符行定位的装置,如图6所示,该装置包括:Correspondingly, the embodiment of the present invention also provides a character line positioning device, as shown in Figure 6, the device includes:
字符信息获取单元2,用于根据待处理图像数据获得候选字符信息;倾斜度获取单元4,用于根据所述候选字符信息获得字符间倾斜角度信息,所述字符间倾斜角度信息用于标识候选字符与所述候选字符的邻域候选字符的位置关系;定位单元6,用于根据所述字符间倾斜角度信息确定所述候选字符的字符行的边界框,以完成定位。The character
其中,如图7所示,倾斜度获取单元4包括:第一位置信息模块40,用于获取所述候选字符信息中候选字符的位置信息;第二位置信息模块42,用于根据所述候选字符的位置信息获得符合所述候选字符的邻域范围条件的其他候选字符的位置信息;倾斜度信息模块44,用于根据所述候选字符的位置信息和所述其他候选字符的位置信息获取所述字符间倾斜角度信息。Wherein, as shown in FIG. 7 , the
如图8所示,定位单元6包括:获取模块60,用于获取所述字符间倾斜角度信息中的与所述候选字符有关的至少一个字符间倾斜角度;量化模块62,用于对各所述字符间倾斜角度的取值范围进行量化;统计模块64,用于统计获得落入各量化区间内的字符间倾斜角度的数目;角度确定模块66,用于根据统计获得各量化区间的所述数目确定字符行倾斜角度;边界确定模块68,用于根据确定的所述字符行倾斜角度确定候选字符的字符行的边界框,以完成定位。As shown in FIG. 8 , the
或,如图9所示,定位单元6包括:获取模块60,用于获取所述字符间倾斜角度信息中的与所述候选字符有关的至少一个字符间倾斜角度;聚类模块61,用于根据各所述字符间倾斜角度进行聚类,以聚类获得的最大类别的中心作为字符行倾斜角度;边界确定模块68,用于根据确定的所述字符行倾斜角度确定候选字符的的字符行边界框,以完成定位。Or, as shown in FIG. 9, the
其中,上述模块和单元的其他具体细节与本发明其他实施例中的一致,此处不做赘述。Wherein, other specific details of the above-mentioned modules and units are consistent with those in other embodiments of the present invention, and will not be repeated here.
在本发明实施例所提供的方案中,根据磁码字符行的空间排列特点(磁码字符中心基本在一条直线上分段紧密排列),利用计算出的候选字符何其邻域字符之间的倾斜角度推定磁码字符行的倾斜角度,从而准确的定位具有一定倾斜角度的磁码字符行。其中,在确定磁码字符行的倾斜角度时,采用各个角度投票的方式计算整个磁码字符行的倾斜角度,提高了倾斜度确定的稳定性。In the scheme provided by the embodiment of the present invention, according to the spatial arrangement characteristics of the magnetic code character row (the center of the magnetic code character is basically closely arranged in segments on a straight line), the calculated candidate character and the inclination between the adjacent characters are used The angle estimates the inclination angle of the magnetic code character row, so as to accurately locate the magnetic code character row with a certain inclination angle. Wherein, when determining the inclination angle of the character row of the magnetic code, the inclination angle of the entire character row of the magnetic code is calculated by voting at each angle, which improves the stability of determining the inclination.
同时,为了避免因为相邻磁码字符间距离太近,不能真实反映磁码字符行的偏转情况,所以对每个磁码字符考察与其环状邻域磁码字符的偏转情况,这样得到的各字符间的倾斜角度能更真实的反映整个磁码字符行的倾斜程度。提高了定位的稳定性和准确性。At the same time, in order to avoid the fact that the distance between adjacent magnetic code characters is too close, the deflection of the magnetic code character row cannot be truly reflected, so the deflection of each magnetic code character and its ring-shaped adjacent magnetic code characters is investigated. The inclination angle between characters can more truly reflect the inclination degree of the entire magnetic code character row. Improved positioning stability and accuracy.
通过以上的实施方式的描述,本邻域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, magnetic discs, optical discs, etc., including several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in various embodiments or some parts of the embodiments.
以上所述的实施方式,并不构成对该技术方案保护范围的限定。任何在上述实施方式的精神和原则之内所作的修改、等同替换和改进等,均应包含在该技术方案的保护范围之内。The implementation methods described above do not constitute a limitation to the scope of protection of the technical solution. Any modifications, equivalent replacements and improvements made within the spirit and principles of the above implementation methods shall be included in the protection scope of the technical solution.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2008102171998A CN101408937B (en) | 2008-11-07 | 2008-11-07 | Character line positioning method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2008102171998A CN101408937B (en) | 2008-11-07 | 2008-11-07 | Character line positioning method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101408937A CN101408937A (en) | 2009-04-15 |
CN101408937B true CN101408937B (en) | 2011-12-21 |
Family
ID=40571945
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2008102171998A Active CN101408937B (en) | 2008-11-07 | 2008-11-07 | Character line positioning method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101408937B (en) |
Families Citing this family (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102779275B (en) * | 2012-07-04 | 2015-06-17 | 广州广电运通金融电子股份有限公司 | Paper characteristic identification method and relative device |
CN105261110B (en) * | 2015-10-26 | 2018-04-06 | 江苏国光信息产业股份有限公司 | A kind of efficiently DSP paper money number recognition methods |
CN106815561A (en) * | 2016-12-22 | 2017-06-09 | 北京五八信息技术有限公司 | Business license printed page analysis method and device |
CN107092864B (en) * | 2017-03-27 | 2020-02-21 | 成都优译信息技术股份有限公司 | Drawing text reading method and system based on cluster analysis |
CN107680108B (en) | 2017-07-28 | 2019-06-21 | 平安科技(深圳)有限公司 | Inclination value-acquiring method, device, terminal and the storage medium of tilted image |
CN108268868B (en) * | 2017-07-28 | 2020-07-10 | 平安科技(深圳)有限公司 | Method and device for acquiring inclination value of identity card image, terminal and storage medium |
CN107918935B (en) * | 2017-12-05 | 2022-03-08 | 深圳市北电仪表有限公司 | Image matching cutting device and cutting method of embedded system |
CN109961068A (en) * | 2017-12-26 | 2019-07-02 | 阿里巴巴集团控股有限公司 | Image recognition, training, searching method and device and equipment, medium |
TWI766930B (en) * | 2018-01-11 | 2022-06-11 | 台達電子工業股份有限公司 | Classification-based character skew correction apparatus and method thereof |
CN111199224B (en) * | 2018-11-20 | 2023-06-23 | 中国电信股份有限公司 | Method and device for recognizing curved characters |
CN110375645B (en) * | 2019-07-04 | 2021-09-28 | 成都绝影智能科技有限公司 | Character size detection method and device |
CN111914764B (en) * | 2020-08-05 | 2023-09-15 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
CN115249362B (en) * | 2022-09-20 | 2022-12-27 | 京华信息科技股份有限公司 | OCR table recognition method and system based on connectivity of pixels in stable direction |
-
2008
- 2008-11-07 CN CN2008102171998A patent/CN101408937B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN101408937A (en) | 2009-04-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101408937B (en) | Character line positioning method and device | |
CN111932537B (en) | Object deformation detection method and device, computer equipment and storage medium | |
CN106778737B (en) | A kind of license plate antidote, device and a kind of video acquisition device | |
WO2018028230A1 (en) | Deep learning-based method and device for segmenting vehicle license plate characters, and storage medium | |
CN113160192A (en) | Visual sense-based snow pressing vehicle appearance defect detection method and device under complex background | |
CN103699905B (en) | Method and device for positioning license plate | |
CN110363202B (en) | Pointer instrument value reading method and computer terminal | |
CN115082419A (en) | Blow-molded luggage production defect detection method | |
CN105205488B (en) | Word area detection method based on Harris angle points and stroke width | |
CN110619333B (en) | Text line segmentation method, text line segmentation device and electronic equipment | |
KR19990072314A (en) | Color image processing apparatus and pattern extracting apparatus | |
CN110276295B (en) | Vehicle identification number detection and identification method and device | |
CN103268481A (en) | Method for extracting text in complex background image | |
CN109376740A (en) | A kind of water gauge reading detection method based on video | |
WO2017041600A1 (en) | Chinese-sensitive code feature pattern detection method and system | |
CN115082444B (en) | Copper pipe weld defect detection method and system based on image processing | |
CN114882026A (en) | Sensor shell defect detection method based on artificial intelligence | |
CN107220647A (en) | Crop location of the core method and system under a kind of blade crossing condition | |
JP3228938B2 (en) | Image classification method and apparatus using distribution map | |
CN111814576A (en) | A deep learning-based image recognition method for shopping receipts | |
CN109472257B (en) | Character layout determining method and device | |
CN101246554A (en) | Multi-object Image Segmentation Method Based on Pixel Labeling | |
CN106815830A (en) | The defect inspection method of image | |
JP3428494B2 (en) | Character recognition device, its character recognition method, and recording medium storing its control program | |
CN115240197A (en) | Image quality evaluation method, image quality evaluation device, electronic apparatus, scanning pen, and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C56 | Change in the name or address of the patentee | ||
CP03 | Change of name, title or address |
Address after: 523000, building 6, 310, 311 and 3, 312 South Industrial Road, Songshan hi tech Industrial Development Zone, Guangdong, Dongguan Patentee after: GUANGDONG MICROPATTERN SOFTWARE CO., LTD. Address before: 523808 room 18, building 509, Songshan overseas student Pioneer Park, Dongguan, Guangdong Patentee before: Dongguan MicroPattern Corporation |