CN106023191A - Optical drawing character edge extraction and edge fitting method based on structure features - Google Patents
Optical drawing character edge extraction and edge fitting method based on structure features Download PDFInfo
- Publication number
- CN106023191A CN106023191A CN201610327790.3A CN201610327790A CN106023191A CN 106023191 A CN106023191 A CN 106023191A CN 201610327790 A CN201610327790 A CN 201610327790A CN 106023191 A CN106023191 A CN 106023191A
- Authority
- CN
- China
- Prior art keywords
- edge
- line segment
- pixel
- character
- fitting
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000000605 extraction Methods 0.000 title claims abstract description 21
- 230000003287 optical effect Effects 0.000 title claims 8
- 239000011159 matrix material Substances 0.000 claims description 7
- 238000010586 diagram Methods 0.000 description 6
- 239000000284 extract Substances 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001149 cognitive effect Effects 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 230000001629 suppression Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2413—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on distances to training or reference patterns
- G06F18/24133—Distances to prototypes
- G06F18/24143—Distances to neighbourhood prototypes, e.g. restricted Coulomb energy networks [RCEN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
Landscapes
- Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
本发明公开了一种基于结构特征的光学刻划字符边缘提取和边缘拟合方法,包括以下步骤:使用Canny算子提取边缘,将真伪边缘模板对应的像素灰度矩阵转换成特征向量,进行标记,利用K最近邻算法根据标记的特征向量去除样本的伪边缘;根据字符的笔画结构特征和断续边缘线段的端点之间的距离构建不同的连接模式,形成像素场景;依照各个像素场景中各边缘线段的位置关系、线段的灰度信息以及线段之间的距离,确定线段端点的连接方式,进行边缘拟合,形成字符轮廓。本发明提取的边缘准确,拟合得到的刻划字符轮廓完整,为后续的字符特征提取带来了很大方便。
The invention discloses a method for edge extraction and edge fitting of optically carved characters based on structural features. Marking, using the K nearest neighbor algorithm to remove the false edge of the sample according to the marked feature vector; constructing different connection modes according to the stroke structure characteristics of the character and the distance between the endpoints of the intermittent edge line segment to form a pixel scene; according to each pixel scene The positional relationship of each edge line segment, the gray information of the line segment, and the distance between the line segments determine the connection mode of the end points of the line segment, and perform edge fitting to form a character outline. The edge extracted by the invention is accurate, and the profile of the character obtained by fitting is complete, which brings great convenience to the subsequent character feature extraction.
Description
技术领域technical field
本发明涉及一种基于结构特征的光学刻划字符边缘提取和边缘拟合方法。The invention relates to a method for edge extraction and edge fitting of optically carved characters based on structural features.
背景技术Background technique
字符边缘提取及其拟合可以构成字符的完整轮廓,是字符识别过程中的重要环节。对于光学刻划字符,常用的边缘提取方法和拟合方法都不能得到良好的结果。由于刻划字符图像的产生过程中,采用条形光源使得与光源平行的笔划会产生高灰度值的像素,而与光源垂直的笔划会产生低灰度值的像素,背景的像素值介于以上两种像素之间,如图1所示。因而,Canny算子无法提取刻划字符的真实边缘,这是因为Canny算子本质上是基于梯度的边缘提取方法。在一个笔划的中间由于光照方向的不同产生了低灰度值像素和高灰度值两种像素,在其交界处产生了大幅度的灰度变化,Canny算子的梯度非最大值抑制算法捕捉到这些变化,把相应位置的像素作为边缘,但它们并不是刻划字符的真实边缘点。Character edge extraction and its fitting can constitute the complete outline of the character, which is an important link in the character recognition process. For optically carved characters, the commonly used edge extraction methods and fitting methods cannot get good results. In the process of generating the character image, the strip light source is used so that the strokes parallel to the light source will produce pixels with high gray value, while the strokes perpendicular to the light source will produce pixels with low gray value, and the pixel value of the background is between Between the above two types of pixels, as shown in FIG. 1 . Therefore, the Canny operator cannot extract the real edge of the character, because the Canny operator is essentially a gradient-based edge extraction method. In the middle of a stroke, two pixels with low gray value and high gray value are generated due to different lighting directions, and a large gray value changes at the junction, which can be captured by the gradient non-maximum suppression algorithm of the Canny operator. Considering these changes, the pixels at the corresponding positions are regarded as edges, but they are not the real edge points that characterize characters.
即使采用某种方法去除伪边缘点,也会产生断续间隔比较大的不连续边缘。若要采用常用的边缘拟和方法如阈值化顺序边缘连接的轮廓提取方法多阈值选取与边缘连接的边缘检测算法以及神经网络边缘拟合都不会取得良好的结果,这是因为这些方法都只是适合于断续点之间的距离较近的情形。Even if some method is used to remove false edge points, discontinuous edges with relatively large intermittent intervals will be produced. If you want to use the commonly used edge fitting methods such as thresholding sequential edge connection contour extraction method, multi-threshold selection and edge connection edge detection algorithm and neural network edge fitting will not achieve good results, because these methods are only It is suitable for situations where the distance between discontinuous points is relatively short.
发明内容Contents of the invention
本发明为了解决上述问题,提出了一种基于结构特征的光学刻划字符边缘提取和边缘拟合方法,本方法首先使用Canny算子提取边缘,基于灰度信息和结构信息提取像素特征,使用k最近邻方法消除Canny算子产生的伪边缘点,继而基于字符的结构特征实现断续边缘的拟合形成字符的轮廓,形成的刻划字符轮廓完整、准确。In order to solve the above-mentioned problems, the present invention proposes a method for edge extraction and edge fitting of optically carved characters based on structural features. The method first uses the Canny operator to extract edges, and extracts pixel features based on grayscale information and structural information. The nearest neighbor method eliminates the false edge points generated by the Canny operator, and then realizes the fitting of intermittent edges based on the structural characteristics of the characters to form the outline of the character, and the formed outline of the character is complete and accurate.
为了实现上述目的,本发明采用如下技术方案:In order to achieve the above object, the present invention adopts the following technical solutions:
一种基于结构特征的光学刻划字符边缘提取和边缘拟合方法,包括以下步骤:A method for edge extraction and edge fitting of optically carved characters based on structural features, comprising the following steps:
(1)使用Canny算子提取边缘,将真伪边缘模板对应的像素灰度矩阵转换成特征向量,进行标记,利用K最近邻算法根据标记的特征向量去除样本的伪边缘;(1) Use the Canny operator to extract the edge, convert the pixel gray matrix corresponding to the true and false edge template into a feature vector, and mark it, and use the K nearest neighbor algorithm to remove the false edge of the sample according to the marked feature vector;
(2)根据字符的笔画结构特征和断续边缘线段的端点之间的距离构建不同的连接模式,形成像素场景;(2) Construct different connection patterns according to the stroke structure characteristics of characters and the distance between the endpoints of intermittent edge segments to form pixel scenes;
(3)依照各个像素场景中各边缘线段的位置关系、线段的灰度信息以及线段之间的距离,确定线段端点的连接方式,进行边缘拟合,形成字符轮廓。(3) According to the positional relationship of each edge line segment in each pixel scene, the gray information of the line segment and the distance between the line segments, determine the connection mode of the end points of the line segment, perform edge fitting, and form a character outline.
所述步骤(1)中,具体步骤包括:In described step (1), concrete steps include:
(1-1)将真伪边缘模板对应的像素灰度矩阵转换成特征向量,同时分配相应的分类标号;(1-1) Convert the pixel grayscale matrix corresponding to the true and false edge template into a feature vector, and assign corresponding classification labels at the same time;
(1-2)根据欧式距离在特征空间中选择k个距离最近的样本;(1-2) Select the k closest samples in the feature space according to the Euclidean distance;
(1-3)统计K-最近邻样本中每个分类标号出现的次数;(1-3) count the number of occurrences of each classification label in the K-nearest neighbor sample;
(1-4)选择出现频率最大的类标号作为待分类边缘点的类标号。(1-4) Select the class label with the highest frequency of occurrence as the class label of the edge points to be classified.
优选的,所述步骤(1-1)中,将真伪边缘模板对应的像素灰度矩阵转换成长度为9的特征向量。Preferably, in the step (1-1), the pixel grayscale matrix corresponding to the true and false edge templates is converted into a feature vector with a length of 9.
所述步骤(2)中,综合考虑字符的笔画结构特征和断续边缘线段的端点之间的距离概括出多种连接模式,将每种连接模式作为一个像素场景,不同的连接模式采取不同的边缘拟和方法。In described step (2), multiple connection modes are summarized by comprehensively considering the distance between the stroke structure characteristics of characters and the endpoints of intermittent edge segments, and each connection mode is used as a pixel scene, and different connection modes take different Edge fitting method.
所述步骤(2)中,根据待拟合的边缘线段位于笔画的位置,彼此之间的排列结构,像素灰度值的大小关系和位置关系的不同来确定不同的像素场景。In the step (2), different pixel scenes are determined according to the position of the edge line segment to be fitted in the stroke, the arrangement structure between each other, the size relationship and the position relationship of the pixel gray value.
所述步骤(3)中,将各个像素场景的线段的端点作为元素,形成链表,进行边缘拟合,从链表的第一个边缘线段的第一个端点开始,通过链表确定每个端点与下一端点的距离和端点周围设定距离范围内的线段数目。In described step (3), the end point of the line segment of each pixel scene is used as element, forms linked list, carries out edge fitting, starts from the first end point of the first edge line segment of linked list, determines each end point and next by linked list The distance from an endpoint and the number of line segments within the specified distance around the endpoint.
所述步骤(3)中,在链表中开始搜索是否存在与第一端点的距离小于设定值的端点,若存在,则将两个端点进行连接,端点坐标采用一次多项式拟和,删除链表中的所述两个端点的连接线段,同时链表长度减1。In described step (3), start to search in linked list whether there is the end point with the distance of first end point less than setting value, if exist, then two end points are connected, end point coordinate adopts polynomial fitting of first order, deletes linked list The connecting line segment of the two endpoints in , while the length of the linked list is reduced by 1.
所述步骤(3)中,在链表中搜索距离第一端点小于设定距离范围的线段,若存在上述线段,则记录线段的端点,统计线段数目,根据线段的数目、灰度级线段位置与像素场景相对应,确定其所属像素场景。In the described step (3), in linked list, search distance first endpoint less than the line segment of setting distance range, if there is above-mentioned line segment, then record the end point of line segment, count the number of line segments, according to the number of line segments, gray level line segment position Corresponding to the pixel scene, determine the pixel scene it belongs to.
所述步骤(3)中,端点的连接采用坐标拟合的方法。In the step (3), the connection of the end points adopts the method of coordinate fitting.
优选的,所述设定距离范围为字符笔画宽度的2-3倍。Preferably, the set distance range is 2-3 times of the stroke width of the character.
本发明的有益效果为:The beneficial effects of the present invention are:
(1)本发明提取的边缘准确,拟合得到的刻划字符轮廓完整,为后续的字符特征提取带来了很大方便。(1) The edge extracted by the present invention is accurate, and the character outline obtained by fitting is complete, which brings great convenience for subsequent character feature extraction.
(2)本发明基于字符的结构特征去确定断续边缘线段方式,实际上是模拟人的视觉和认知原理;无论第一个线段是哪一个线段,也无论这些线段端点之间的距离多大,由于它们都是字符某个或相邻的两个笔画上,都能实现正确的连接。(2) The present invention is based on the structural characteristics of characters to determine the way of intermittent edge line segments, which actually simulates human vision and cognitive principles; no matter which line segment the first line segment is, and no matter how much the distance between the end points of these line segments is , since they are all on one or two adjacent strokes of a character, correct connection can be realized.
附图说明Description of drawings
图1为本发明的刻划字符图像示意图;Fig. 1 is a schematic diagram of a character image of the present invention;
图2为本发明的伪边缘模板集合示意图;Fig. 2 is a schematic diagram of a set of false edge templates of the present invention;
图3为本发明的真边缘模板集合示意图;Fig. 3 is a schematic diagram of a set of true edge templates of the present invention;
图4为本发明的场景模板集合示意图;FIG. 4 is a schematic diagram of a set of scene templates of the present invention;
图5为本发明的连接模式3示意图;Fig. 5 is a schematic diagram of connection mode 3 of the present invention;
图6为传统方法Canny算子提取的边缘图,有伪边缘点;Figure 6 is the edge map extracted by the traditional method Canny operator, with false edge points;
图7为本发明去除伪边缘的结果示意图;Fig. 7 is a schematic diagram of the result of removing false edges in the present invention;
图8为拟合过程及其结果图;Fig. 8 is the fitting process and its result figure;
图9为本发明的流程图。Fig. 9 is a flowchart of the present invention.
具体实施方式:detailed description:
下面结合附图与实施例对本发明作进一步说明。The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
基于结构特征的光学刻划字符边缘提取和边缘拟合方法,包括以下步骤:The edge extraction and edge fitting method of optically carved characters based on structural features includes the following steps:
步骤一,基于k最近邻算法去除伪边缘。Step 1, remove false edges based on the k-nearest neighbor algorithm.
特征空间的合理选择是正确分类的最关键要素,既要考虑特征描述的准确性,还要考虑样本的平衡问题。K最近邻算法的缺点是当样本不平衡时,有可能导致当输入一个新样本时,该样本的k个邻居中大容量类的样本占多数。Reasonable selection of feature space is the most critical element of correct classification, not only the accuracy of feature description, but also the balance of samples must be considered. The disadvantage of the K-nearest neighbor algorithm is that when the samples are unbalanced, it may cause that when a new sample is input, the samples of the large-capacity class among the k neighbors of the sample account for the majority.
分析canny算子提取的边缘点周边像素的灰度分布发现,真边缘点和假边缘点的8邻域灰度分布具有明显的不同。伪边缘点总是处于一个笔画中高灰度像素和低灰度像素的交界,真边缘点要么处于高灰度像素和背景中灰度像素的交界,要么处于低灰度像素和背景中灰度像素的交界。为此使用像素的8邻域作为其特征,为叙述方便,称像素的8邻域为边缘模板,真边缘像素点的8邻域叫做真边缘模板,伪边缘像素点的8邻域叫做伪边缘模板,真、伪边缘模板构成了运用k最近邻算法的特征空间。By analyzing the gray distribution of surrounding pixels of edge points extracted by canny operator, it is found that the gray distribution of 8 neighborhoods of real edge points and false edge points is significantly different. False edge points are always at the junction of high grayscale pixels and low grayscale pixels in a stroke, and true edge points are either at the junction of high grayscale pixels and grayscale pixels in the background, or at the junction of low grayscale pixels and grayscale pixels in the background the junction. For this reason, the 8 neighborhoods of pixels are used as its features. For the convenience of description, the 8 neighborhoods of pixels are called edge templates, the 8 neighborhoods of true edge pixels are called true edge templates, and the 8 neighborhoods of false edge pixels are called false edges. Templates, true and false edge templates constitute the feature space using the k-nearest neighbor algorithm.
由于伪边缘点总是处于一个笔画中两种灰度级别的像素区域的交界,按照伪边缘点上下左右周围像素点的灰度取值情况将伪边缘模板分为以下8类,共32种结构。前16种模板中处于中心的伪边缘点为低灰度值,后16种模板中伪边缘点为高灰度值,如图2所示。Since the pseudo-edge points are always at the junction of two gray-level pixel areas in a stroke, the pseudo-edge templates are divided into the following 8 categories according to the gray values of the pixels around the pseudo-edge points, with a total of 32 structures . The false edge points in the center of the first 16 templates have low gray values, and the false edge points in the latter 16 templates have high gray values, as shown in Figure 2.
真边缘点要么处于高灰度像素区域和背景的交界,要么处于低灰度区域和背景的交界。因而按照边缘点上下左右周围像素点的灰度取值情况将真边缘模板分为以下六类,24种结构,如图3所示。The true edge point is either at the junction of the high-grayscale pixel area and the background, or at the junction of the low-grayscale area and the background. Therefore, the true edge templates are divided into the following six categories and 24 structures according to the gray values of the upper, lower, left, and right surrounding pixels of the edge point, as shown in Figure 3.
需要说明,模板中三种灰度的取值是通过直方图分析用高、中、低三种灰度像素的灰度均值来表示的。It should be noted that the values of the three gray levels in the template are represented by the gray mean values of the high, middle and low gray level pixels through histogram analysis.
算法步骤:Algorithm steps:
将真伪边缘模板对应的像素灰度矩阵转换成长度为9的特征向量,同时分配相应的分类标号;Convert the pixel grayscale matrix corresponding to the true and false edge template into a feature vector with a length of 9, and assign the corresponding classification label at the same time;
根据欧式距离在特征空间中选择k个距离最近的样本;Select the k nearest samples in the feature space according to the Euclidean distance;
统计K-最近邻样本中每个分类标号出现的次数;Count the number of occurrences of each classification label in the K-nearest neighbor sample;
选择出现频率最大的类标号作为待分类边缘点的类标号。Select the class label with the highest frequency as the class label of the edge point to be classified.
步骤二,基于结构特征的断续边缘拟合。Step two, intermittent edge fitting based on structural features.
1.特征描述1. Characteristic description
综合考虑字符的笔画结构特征和断续边缘线段的端点之间的距离概括出16种连接模式,涉及16种实际的像素场景,不同的连接模式采取不同的边缘拟和方法。具体来说就是在不同的连接模式下,根据各边缘线段的位置关系、线段的灰度信息以及线段之间的距离等三个要素选择正确的边缘端点连接关系。Considering the stroke structure characteristics of characters and the distance between the endpoints of intermittent edge segments, 16 connection modes are summarized, involving 16 actual pixel scenes. Different connection modes adopt different edge fitting methods. Specifically, in different connection modes, the correct connection relationship of edge endpoints is selected according to three elements: the positional relationship of each edge line segment, the gray information of the line segment, and the distance between the line segments.
16种像素场景如图4所示,它们的笔画特征描述如下。The 16 pixel scenes are shown in Fig. 4, and their stroke features are described as follows.
场景1,待拟和的三个边缘线段处于一个笔画的末端,两条平行边缘线段具有相同的灰度级别,另外一个边缘线段的像素灰度高于前者,一个边缘端点附近有两个其它边缘的端点,需要选择其中的一个进行边缘拟合。Scenario 1, the three edge segments to be fitted are at the end of a stroke, the two parallel edge segments have the same gray level, the pixel gray level of the other edge segment is higher than the former, and there are two other edges near the end of one edge , you need to choose one of them for edge fitting.
场景2待拟和的四个边缘线段处于一个笔画的中部,且呈对称排列结构,像素灰度值高的一对线段相对位置处于右上方,像素灰度值低的一对线段相对位置处于左下方。一个边缘端点附近有三个其它边缘的端点,需要选择其中的一个进行边缘拟合。The four edge line segments to be fitted in scene 2 are in the middle of a stroke, and they are arranged symmetrically. The relative position of a pair of line segments with high pixel gray value is at the upper right, and the relative position of a pair of line segments with low pixel gray value is at the lower left square. There are three other edge endpoints near one edge endpoint, and one of them needs to be selected for edge fitting.
场景3到场景5都和场景2相似,区别在于场景3中像素灰度值高的一对线段相对位置处于左上方,像素灰度值低的一对线段相对位置处于右下方;场景4中像素灰度值高的一对线段相对位置处于右下方,像素灰度值低的一对线段相对位置处于左上方;场景5中像素灰度值高的一对线段相对位置处于左下方,像素灰度值低的一对线段相对位置处于右上方;Scenes 3 to 5 are similar to scene 2, the difference is that in scene 3, the relative position of a pair of line segments with high pixel gray value is at the upper left, and the relative position of a pair of line segments with low pixel gray value is at the lower right; The relative position of a pair of line segments with high gray value is at the lower right, and the relative position of a pair of line segments with low pixel gray value is at the upper left; The relative position of a pair of line segments with a low value is at the upper right;
场景6至场景8是后叙场景15经过边缘拟合后衍生出的几种情形。场景6和5相似,区别在于像素灰度值低的一对线段相对位置一个处于右下方,另一个处于右上方。场景8和3相似,像素灰度值高的一对线段相对位置一个处于左上方,一个处于右上方。场景7中像素灰度值高的一对线段相对位置是左右关系,像素灰度值高的一对线段相对位置是上下关系。Scene 6 to Scene 8 are several situations derived from Scene 15 after edge fitting. Scenes 6 and 5 are similar, the difference is that the relative position of a pair of line segments with low pixel gray value is at the bottom right and the other is at the top right. Scenes 8 and 3 are similar, and the relative positions of a pair of line segments with high pixel gray values are in the upper left and the other in the upper right. In scene 7, the relative position of a pair of line segments with high pixel gray value is a left-right relationship, and the relative position of a pair of line segments with high pixel gray value is an up-down relationship.
场景9至场景12是后续场景13和场景14经过边缘拟合后衍生出的几种情形。待拟和的四个边缘线段中,有三个线段是低灰度像素值,另一个是高灰度值。像素灰度值低的三条线段都是垂直或接近垂直的线段,呈平行或上下一致的规则排列关系。像素灰度值高的线段是水平的线段。一个边缘端点附近有三个其它边缘的端点,需要选择其中的一个进行边缘拟合。Scenario 9 to Scenario 12 are several scenarios derived from subsequent scenarios 13 and 14 after edge fitting. Among the four edge line segments to be fitted, three line segments have low grayscale pixel values and the other one has high grayscale value. The three line segments with low pixel gray value are all vertical or nearly vertical line segments, in a regular arrangement of parallel or consistent up and down. A line segment with a high pixel gray value is a horizontal line segment. There are three other edge endpoints near one edge endpoint, and one of them needs to be selected for edge fitting.
场景13,待拟和的六个边缘线段处于横笔画与竖笔画交界处,且呈对称排列结构,像素灰度值高的一对线段相对位置处于右侧,像素灰度值低的两对线段相对位置分别处于左上方和左下方。一个边缘端点附近有5个其它边缘的端点,需要选择其中的一个进行边缘拟合。场景14相似于场景13,二者呈水平景象关系。Scene 13, the six edge line segments to be fitted are located at the junction of horizontal strokes and vertical strokes, and they are arranged symmetrically. The relative position of the pair of line segments with high pixel gray value is on the right side, and the two pairs of line segments with low pixel gray value The relative positions are upper left and lower left respectively. There are 5 other edge endpoints near one edge endpoint, and one of them needs to be selected for edge fitting. Scene 14 is similar to Scene 13, and the two are in a horizontal scene relationship.
场景15,待拟和的六个边缘线段呈星形对称分布关系,按照斜率大小分为三组线段,斜率为零的一对线段都具有较高的像素灰度值,斜率为负的一对线段具有较低的像素灰度值,另一对线段则一条具有较高的像素灰度值一条具有较低的像素灰度值。Scene 15, the six edge line segments to be fitted are in a star-shaped symmetrical distribution relationship, and are divided into three groups of line segments according to the slope. A pair of line segments with a slope of zero have higher pixel gray value, and a pair of line segments with a negative slope A line segment has a lower pixel gray value, and another pair of line segments has one with a higher pixel gray value and the other with a lower pixel gray value.
场景16,待拟和的八个边缘线段呈星形对称分布关系,按照斜率大小和坐标位置分为四对线段,分别处于左上、左下、右上、右下方。一个边缘端点附近有7个其它边缘的端点,需要选择其中的一个进行边缘拟合。In scene 16, the eight edge line segments to be fitted are symmetrically distributed in a star shape, and are divided into four pairs of line segments according to the slope and coordinate position, which are respectively located in the upper left, lower left, upper right, and lower right. There are 7 other edge endpoints near one edge endpoint, and one of them needs to be selected for edge fitting.
2.具体描述:2. Specific description:
用Ci(i=1,2....n)表示链表中的任一边缘线段,Ci(1)和Ci(2)表示其第1端点和第2端点。边缘拟合时,总是从链表中的第一个边缘线段的C1(1)开始,我们关心C1(1)与其它边缘线段Ci(i=2....n)的端点Ci(1)和端点Ci(2)的距离D1i(1)和D1i(2)。边缘拟合还关心端点C1(1)周围一定距离范围Dn内的线段数目N,以便判断当前连接属于哪一种连接模式。使用投影法检测字符笔划的宽度w,观察和实验发现取Dn=2.5W是合适的。Use Ci(i=1,2....n) to represent any edge segment in the linked list, and Ci(1) and Ci(2) to represent its first end point and second end point. When fitting the edge, it always starts from C1(1) of the first edge segment in the linked list, and we care about the endpoint Ci(1) between C1(1) and other edge segments Ci(i=2....n). The distances D1i(1) and D1i(2) from the endpoint Ci(2). Edge fitting also cares about the number N of line segments within a certain distance range Dn around the endpoint C1(1), so as to determine which connection mode the current connection belongs to. Use the projection method to detect the width w of the stroke of the character. Observations and experiments have found that Dn=2.5W is appropriate.
首先,在{Ci(1),Ci(2)i=2,3...}中搜索D1i(1)或D1i(2)小于0.3*w的端点Cj(k)(j=2,3...k=1,2),如果Cj(k)存在,C1(1)与Cj(k)直接连接,端点坐标采用一次多项式拟和,删除链表中的Cj,链表长度减1。此为连接模式1。First, search for endpoints Cj(k) where D1i(1) or D1i(2) is less than 0.3*w in {Ci(1), Ci(2)i=2,3...} (j=2,3. ..k=1,2), if Cj(k) exists, C1(1) is directly connected to Cj(k), the endpoint coordinates are fitted by a first-degree polynomial, Cj in the linked list is deleted, and the length of the linked list is reduced by 1. This is connection mode 1.
其次,在{Ci i=2,3...}中搜索min(D1i(1),D1i(2))小于2.5*w的线段Cj,如果Cj存在,记录这些端点Cj(k)k=1,2。根据线段数目Number,划分为以下几种方式:Secondly, search for line segments Cj whose min(D1i(1), D1i(2)) is less than 2.5*w in {Ci i=2,3...}, if Cj exists, record these endpoints Cj(k)k=1 ,2. According to the number of line segments, it can be divided into the following ways:
(1)如果Number=1,且不是字符轮廓的最后一个断续边缘线段,C1(1)与Cj(k)直接连接。此为连接模式1。(1) If Number=1, and it is not the last intermittent edge line segment of the character outline, C1(1) is directly connected to Cj(k). This is connection mode 1.
(2)如果Number=2,,对应于场景1,使用灰度和斜率信息选择连接路径。此为连接模式2。(2) If Number=2, corresponding to scene 1, use grayscale and slope information to select a connection path. This is connection mode 2.
(3)如果Number=3,对应于场景2到场景12,使用线段的灰度信息以及线段的位置关系进行区分,选择不同的端点连接方法。相应地称为连接模式3,6......13。(3) If Number=3, corresponding to scene 2 to scene 12, the gray level information of the line segment and the positional relationship of the line segment are used to distinguish, and different endpoint connection methods are selected. Correspondingly referred to as connection modes 3, 6...13.
(4)如果Number=4,5,去掉距离最远的线段,按照Number=3处理。(4) If Number=4, 5, remove the line segment with the farthest distance, and process according to Number=3.
(5)如果Number=6对应于场景13,14,15,使用线段的灰度信息、斜率信息以及位置关系进行区分,选择不同的连接方法。称为连接模式14,15,16。(5) If Number=6 corresponds to scenes 13, 14, and 15, use the grayscale information, slope information, and positional relationship of the line segments to distinguish, and select different connection methods. Called connection modes 14, 15, 16.
(6)如果Number>7,通常发生在断续边缘线段长度较短,在2.5W范围内断续边缘线段比较稠密的情形,如字符“B”的中间部分就属于这种情况。其中当Number=8时,可以根据线段的斜率判断如果对应于场景16(两对平行线段),就根据线段的位置关系进行连接,称为连接模式16;否则和其它Number>7的情况一样作如下相同的处理,减小搜索范围,取Dn=1.5W,重新搜索端点C1(1)周围Dn范围内的线段数目N,使得N<=6,然后按照上述方法确定连接模式。(6) If Number>7, it usually occurs when the length of the intermittent edge line segment is relatively short, and the intermittent edge line segment is relatively dense within the range of 2.5W, such as the middle part of the character "B". Wherein when Number=8, it can be judged according to the slope of the line segment that if it corresponds to scene 16 (two pairs of parallel line segments), it is connected according to the positional relationship of the line segment, which is called connection mode 16; otherwise, it is the same as other Number>7 situations. The same process as follows, reduce the search range, take Dn=1.5W, re-search the number N of line segments within the range of Dn around the endpoint C1(1), so that N<=6, and then determine the connection mode according to the above method.
3.边缘拟合方法3. Edge fitting method
实际上是场景识别从而确定连接模式,下面以连接模式3为例说明。当Number=3时,共有场景2到场景12等十种场景,C1(1)周围有3个线段,需要确定C1(1)和另外三条线段中的哪一条线段的哪一个端点去连接,在场景2到场景12等十一种场景产生连接模式3到连接模式13等十一种连接模式。In fact, scene recognition is used to determine the connection mode. The connection mode 3 is taken as an example below. When Number=3, there are ten scenes from scene 2 to scene 12 in total. There are 3 line segments around C1(1), and it is necessary to determine which end point of which line segment C1(1) is connected to the other three line segments. The eleven kinds of scenarios such as scene 2 to scene 12 generate eleven connection modes such as connection mode 3 to connection mode 13 .
采用集合分解的方法进行场景识别,识别时需要使用各线段的灰度信息、距离信息和斜率信息。线段C1随着线段连接长度不断增加,从C1(1)开始取其10个点求其平均坐标XY1(x,y)和平均灰度Bgray1;其余三条线段的平均坐标和平均灰度分别用XY2(x,y),XY3(x,y),XY4(x,y)和Bgray1,Bgray2,Bgray3,Bgray4表示。The method of set decomposition is used for scene recognition, and the gray information, distance information and slope information of each line segment are needed for recognition. The line segment C1 increases with the length of the line segment connection, take 10 points from C1(1) to find its average coordinate XY1(x, y) and average gray level Bgray1; the average coordinates and average gray level of the other three line segments are respectively used by XY2 (x,y), XY3(x,y), XY4(x,y) and Bgray1, Bgray2, Bgray3, Bgray4 represent.
十一种场景构成集合B。首先,根据三条线段的灰度信息将集合B划分成子集B1和B2。B1包含场景2到场景8共七个场景,四条线段的平均灰度Bgray1,Bgray2,Bgray3,Bgray4中,一对线段的像素灰度值较高,而另一对线段的像素灰度值较低;B2包含场景9到场景12,四条线段中一条线段的像素灰度值较高,另外三条线段的像素灰度值较低。Eleven scenarios constitute set B. First, the set B is divided into subsets B1 and B2 according to the gray information of the three line segments. B1 contains a total of seven scenes from scene 2 to scene 8. Among the average gray levels of the four line segments Bgray1, Bgray2, Bgray3, and Bgray4, the pixel gray value of one pair of line segments is higher, while the pixel gray value of the other pair of line segments is lower. ; B2 includes scenes 9 to 12, one of the four line segments has a higher pixel gray value, and the other three line segments have a lower pixel gray value.
其次,根据集合线段的距离信息将B1划分成子集B11和B12。使用平均坐标XY1(x,y)计算两个灰度相等(近)的线段的距离,高灰度值的一对线段之间的距离用Hgd表示,低灰度值的一对线段之间的距离为Lgd。B11包含场景3,4,5,6,四个场景,Hgd和Lgd都小于1.5W;B12包含场景6、7、8三个场景,Hgd和Lgd中只有一个小于1.5W。Second, divide B1 into subsets B11 and B12 according to the distance information of the set of line segments. Use the average coordinates XY1(x,y) to calculate the distance between two line segments with equal (near) gray levels, the distance between a pair of line segments with high gray value is represented by Hgd, and the distance between a pair of line segments with low gray value The distance is Lgd. B11 includes scenes 3, 4, 5, and 6. Both Hgd and Lgd are less than 1.5W; B12 includes scenes 6, 7, and 8. Only one of Hgd and Lgd is less than 1.5W.
集合B11、B12和B2都是不能再分的最小集合。集合B11的四种场景对应于连接模式3、4、5、6;集合B12的三种场景对应于连接模式7、8、9;集合B2的四种场景对应于连接模式10、11、12、13。Sets B11, B12, and B2 are the smallest sets that cannot be further divided. The four scenes of set B11 correspond to connection modes 3, 4, 5, 6; the three scenes of set B12 correspond to connection modes 7, 8, 9; the four scenes of set B2 correspond to connection modes 10, 11, 12, 13.
在集合B11中,根据线段的相对位置关系来区分四种场景。低灰度值的一对线段对的行、列平均值用LL和LH表示,高灰度值的一对线段对的行、列平均值用HL和HH表示,若LL>HL且LH<HH则为场景2,亦即连接模式3;若LL>HL且LH>HH则为场景3,亦即连接模式4;若LL<HL且LH<HH则为场景4,亦即连接模式5;若LL<HL且LH>HH则为场景5,亦即连接模式6。In the set B11, four scenarios are distinguished according to the relative positional relationship of the line segments. The row and column average values of a pair of line segment pairs with low gray value are represented by LL and LH, and the row and column average values of a pair of line segment pairs with high gray value are represented by HL and HH, if LL>HL and LH<HH It is scene 2, that is, connection mode 3; if LL>HL and LH>HH, it is scene 3, that is, connection mode 4; if LL<HL and LH<HH, it is scene 4, that is, connection mode 5; if LL<HL and LH>HH is scenario 5, that is, connection mode 6.
在集合B12中,使用线段的斜率信息区分三种场景。高灰度线段对的斜率分别用HS1和HS2表示,低灰度线段对的斜率分别用LS1和LS2表示。若HS1=HS2则为场景6亦即连接模式7,若LS1=LS2则为场景8亦即连接模式9,否则为场景7亦即连接模式8。In the set B12, the slope information of the line segment is used to distinguish three scenarios. The slopes of the high gray line segment pairs are represented by HS1 and HS2, respectively, and the slopes of the low gray line segment pairs are represented by LS1 and LS2, respectively. If HS1=HS2, it is scene 6, that is, connection mode 7; if LS1=LS2, it is scene 8, that is, connection mode 9; otherwise, it is scene 7, that is, connection mode 8.
在集合B2中,需要根据灰度信息和列位置信息从三条低灰度线段中排除左右平行排列的一对低灰度线段,计算剩余的一条低灰度线段各像素的行平均LL1值与列平均值LH1,同时计算高灰度线段各像素的行平均HL1值与列平均值HH1,利用位置信息LL1、LH1、HL1、HH1确定二者的位置关系从而区分出场景9到场景12,亦即连接模式10到13。In set B2, it is necessary to exclude a pair of low-gray-scale line segments arranged in parallel from the left and right from the three low-gray-scale line segments according to the gray-scale information and column position information, and calculate the row average LL1 value and column Average value LH1, calculate the row average HL1 value and column average value HH1 of each pixel in the high gray line segment at the same time, use the position information LL1, LH1, HL1, HH1 to determine the positional relationship between the two to distinguish scene 9 to scene 12, that is Connection mode 10 to 13.
确定连接模式后,需要进一步确定各个线段的在其场景中的具体位置,方能确定具体的端点连接关系,从而实现边缘拟和。仍以连接模式3为例说明。After determining the connection mode, it is necessary to further determine the specific position of each line segment in its scene in order to determine the specific connection relationship between the endpoints, so as to achieve edge fitting. Still take connection mode 3 as an example for illustration.
共有四个线段{C1 Ci Cj Ck},ij k=2,3,4...N,集合中的第一条线段总是C1。上述特征识别中的灰度排序结果用{Ca Cb Cc Cd}表示,Ca和Cb是一对像素灰度值较低的一对线段,Cc和Cd则是一对像素灰度值较高的一对线段。There are four line segments {C1 Ci Cj Ck}, ij k=2,3,4...N, the first line segment in the set is always C1. The grayscale sorting results in the above feature recognition are represented by {Ca Cb Cc Cd}, where Ca and Cb are a pair of line segments with a lower gray value of a pair of pixels, and Cc and Cd are a pair of line segments with a higher gray value of a pair of pixels. on the line segment.
比较Ca和Cb的列平均值,列平均值小的赋之标号④,列平均值大的赋之标号③;比较Cc和Cd的行平均值,行平均值小的赋之标号①,行平均值大的赋之标号②。如果线段C1的标号为①,就选择标号为④的线段作为连接线段,如果线段C1的标号为④,就选择标号为①的线段作为连接线段;如果线段C1的标号为②,就选择标号为③的线段作为连接线段,如果线段C1的标号为③,就选择标号为②的线段作为连接线段。线段C1的连接端点总是取C1(1),被连接线段的连接端点在上述特征识别中已经确定。Compare the column average values of Ca and Cb, assign the label ④ to the column average value that is small, and assign label ③ to the column average value that is large; compare the row average values of Cc and Cd, assign the label ① to the row average value that is small The one with the larger value is given the label ②. If the label of the line segment C1 is ①, select the line segment labeled ④ as the connecting line segment; if the label of the line segment C1 is ④, select the line segment labeled ① as the connecting line segment; The line segment of ③ is used as the connecting line segment, if the label of the line segment C1 is ③, the line segment labeled as ② is selected as the connecting line segment. The connection endpoint of the line segment C1 is always C1(1), and the connection endpoint of the connected line segment has been determined in the above feature recognition.
端点连接采用坐标拟和的方法,如果端点之间的距离小于0.8W,采用1次多项式拟和,否则采用2次多项式拟和。The method of coordinate fitting is used for the connection of the end points. If the distance between the end points is less than 0.8W, the first degree polynomial is used for fitting, otherwise the second degree polynomial is used for fitting.
仿真结果:Simulation results:
以典型字符G为例进行说明,如图6所示,现有单纯使用Canny算子提取的边缘,有伪边缘点。如图7所示,采用步骤一去除伪边缘的结果,结合图8中步骤二拟合过程及其结果,可以看出,本发明能够很好地去除不连续的问题,且没有伪边缘,识别准确度高,拟合得到的刻划字符轮廓完整。A typical character G is taken as an example for illustration. As shown in FIG. 6 , there are false edge points in the existing edge extracted simply by using the Canny operator. As shown in Figure 7, using the result of step 1 to remove false edges, combined with the fitting process and results of step 2 in Figure 8, it can be seen that the present invention can remove the problem of discontinuity well, and there is no false edge, and the identification The accuracy is high, and the contour of the character obtained by fitting is complete.
上述虽然结合附图对本发明的具体实施方式进行了描述,但并非对本发明保护范围的限制,所属领域技术人员应该明白,在本发明的技术方案的基础上,本领域技术人员不需要付出创造性劳动即可做出的各种修改或变形仍在本发明的保护范围以内。Although the specific implementation of the present invention has been described above in conjunction with the accompanying drawings, it does not limit the protection scope of the present invention. Those skilled in the art should understand that on the basis of the technical solution of the present invention, those skilled in the art do not need to pay creative work Various modifications or variations that can be made are still within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610327790.3A CN106023191B (en) | 2016-05-16 | 2016-05-16 | A kind of optics delineation character edge extraction and edge fitting method based on structure feature |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610327790.3A CN106023191B (en) | 2016-05-16 | 2016-05-16 | A kind of optics delineation character edge extraction and edge fitting method based on structure feature |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106023191A true CN106023191A (en) | 2016-10-12 |
CN106023191B CN106023191B (en) | 2018-11-27 |
Family
ID=57098697
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610327790.3A Active CN106023191B (en) | 2016-05-16 | 2016-05-16 | A kind of optics delineation character edge extraction and edge fitting method based on structure feature |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106023191B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107194435A (en) * | 2017-06-19 | 2017-09-22 | 山东建筑大学 | A kind of character representation true and false based on the optics delineation character edge point for simplifying neighborhood and sorting technique and application |
CN109596059A (en) * | 2019-01-07 | 2019-04-09 | 南京航空航天大学 | A kind of aircraft skin gap based on parallel lines structure light and scale measurement method |
CN118036628A (en) * | 2023-08-28 | 2024-05-14 | 武汉金顿激光科技有限公司 | Work piece intelligent management method, system and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030198386A1 (en) * | 2002-04-19 | 2003-10-23 | Huitao Luo | System and method for identifying and extracting character strings from captured image data |
CN105279507A (en) * | 2015-09-29 | 2016-01-27 | 山东建筑大学 | Method for extracting outline of carved character |
-
2016
- 2016-05-16 CN CN201610327790.3A patent/CN106023191B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030198386A1 (en) * | 2002-04-19 | 2003-10-23 | Huitao Luo | System and method for identifying and extracting character strings from captured image data |
CN105279507A (en) * | 2015-09-29 | 2016-01-27 | 山东建筑大学 | Method for extracting outline of carved character |
Non-Patent Citations (3)
Title |
---|
JING YU等: "Double-edge-model based character stroke extraction from complex backgrounds", 《19TH INTERNATIONAL CONFERENCE ON PATTERN RECOGNITION》 * |
宋怀波等: "基于三叉点特征的激光刻蚀标牌字符识别", 《光电子·激光》 * |
张思俊等: "基于C army算子边缘检测的车牌图像增强方法", 《重庆交通大学学报(自然科学版)》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107194435A (en) * | 2017-06-19 | 2017-09-22 | 山东建筑大学 | A kind of character representation true and false based on the optics delineation character edge point for simplifying neighborhood and sorting technique and application |
CN107194435B (en) * | 2017-06-19 | 2020-07-31 | 山东建筑大学 | A simplified neighborhood-based feature representation and classification method for true and false edge points of optically scribed characters and its application |
CN109596059A (en) * | 2019-01-07 | 2019-04-09 | 南京航空航天大学 | A kind of aircraft skin gap based on parallel lines structure light and scale measurement method |
CN118036628A (en) * | 2023-08-28 | 2024-05-14 | 武汉金顿激光科技有限公司 | Work piece intelligent management method, system and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106023191B (en) | 2018-11-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110148196B (en) | Image processing method and device and related equipment | |
CN105893949B (en) | A kind of method for detecting lane lines under complex road condition scene | |
CN109886896B (en) | A blue license plate segmentation and correction method | |
CN102722707A (en) | License plate character segmentation method based on connected region and gap model | |
CN105184292B (en) | The structural analysis of handwritten form mathematical formulae and recognition methods in natural scene image | |
CN102375982A (en) | Multi-character characteristic fused license plate positioning method | |
CN104463138B (en) | The text positioning method and system of view-based access control model structure attribute | |
CN105893925A (en) | Human hand detection method based on complexion and device | |
CN103902981A (en) | Method and system for identifying license plate characters based on character fusion features | |
CN106295528A (en) | A kind of vehicle checking method based on multi-part spatial relation GMM modeling | |
CN103258203A (en) | Method for automatically extracting road centerline of remote-sensing image | |
CN103295009B (en) | Based on the license plate character recognition method of Stroke decomposition | |
CN104680531B (en) | A kind of connection amount statistical information extracting method and VLSI structure | |
CN104331688A (en) | Detonator shell dot character identifying method | |
CN114419647A (en) | Table information extraction method and system | |
CN110473174B (en) | A method for calculating the exact number of pencils based on images | |
CN108960239A (en) | A kind of laser-induced thermal etching detonator with metal shell code character dividing method based on image procossing | |
CN103226696A (en) | License plate recognition system and license plate recognition method | |
EP2813973A1 (en) | Method and system for processing video image | |
CN106023191B (en) | A kind of optics delineation character edge extraction and edge fitting method based on structure feature | |
CN106447673A (en) | Chip pin extraction method under non-uniform illumination condition | |
CN104598907A (en) | Stroke width figure based method for extracting Chinese character data from image | |
CN110046618B (en) | License plate recognition method based on machine learning and maximum extremum stable region | |
CN102938074B (en) | Self-adaptive extraction method of badminton field or tennis field in virtual advertising system during sports live broadcast | |
CN106897989B (en) | A Fingerprint Image Segmentation Method Based on Linear Density Calculation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |