CN116704220A - A Contour Target Recognition Method Based on the Combination of Centroid Height Increment and DTW - Google Patents
A Contour Target Recognition Method Based on the Combination of Centroid Height Increment and DTW Download PDFInfo
- Publication number
- CN116704220A CN116704220A CN202310702710.8A CN202310702710A CN116704220A CN 116704220 A CN116704220 A CN 116704220A CN 202310702710 A CN202310702710 A CN 202310702710A CN 116704220 A CN116704220 A CN 116704220A
- Authority
- CN
- China
- Prior art keywords
- image
- contour
- centroid
- centroid height
- height increment
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/761—Proximity, similarity or dissimilarity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/66—Analysis of geometric attributes of image moments or centre of gravity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/751—Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Databases & Information Systems (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Multimedia (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
本发明提供一种基于质心高度增量与DTW相结合的轮廓目标识别方法,涉及轮廓目标识别技术领域。基于质心高度增量与DTW相结合的轮廓目标识别方法包括以下步骤:求取模板图像和目标图像的质心高度增量特征矩阵;通过DTW算法对模板图像和目标图像的质心高度增量特征矩阵进行比对,得到第一特征距离;将目标图像翻转后,求取翻转图像的质心高度增量特征矩阵;通过DTW算法对模板图像和翻转图像的质心高度增量特征矩阵进行比对,得到第二特征距离;通过最小值函数求取第一特征距离与第二特征距离中的最小特征距离;在最小特征距离中引入形状复杂度求取相似性距离,根据相似性距离输出识别结果。从而,可以保证在识别率效果较好的同时,提升目标识别的实时性。
The invention provides a contour target recognition method based on the combination of centroid height increment and DTW, and relates to the technical field of contour target recognition. The contour target recognition method based on the combination of centroid height increment and DTW includes the following steps: Find the centroid height increment feature matrix of the template image and the target image; use the DTW algorithm to calculate the centroid height increment feature matrix of the template image and the target image Compare to obtain the first feature distance; after flipping the target image, obtain the centroid height incremental feature matrix of the flipped image; compare the template image and the flipped image's centroid height incremental feature matrix through the DTW algorithm, and obtain the second Feature distance; use the minimum value function to obtain the minimum feature distance between the first feature distance and the second feature distance; introduce shape complexity into the minimum feature distance to obtain the similarity distance, and output the recognition result according to the similarity distance. Therefore, it can be ensured that the real-time performance of target recognition can be improved while the recognition rate effect is good.
Description
技术领域technical field
本发明涉及目标识别技术领域,尤其涉及一种基于质心高度增量与DTW相结合的轮廓目标识别方法。The invention relates to the technical field of target recognition, in particular to a contour target recognition method based on the combination of centroid height increment and DTW.
背景技术Background technique
在目标识别领域,形状是目标匹配中一项有效且利用率较高的特征。通常,形状的表示方法包括基于轮廓的形状表示、基于区域的形状表示和基于骨架的形状表示。而轮廓因其具有更加丰富的信息,不易受到光照、物体颜色和纹理变化的影响,能够有效的描述大尺度范围的物体结构等优点,被越来越多的应用在目标识别方法中。In the field of object recognition, shape is an effective and highly utilized feature in object matching. Generally, shape representation methods include contour-based shape representation, region-based shape representation and skeleton-based shape representation. Contours are more and more used in object recognition methods because they have richer information, are not easily affected by changes in illumination, object color, and texture, and can effectively describe large-scale object structures.
相关技术中,有的通过动态规划算法(Dynamic Programming,DP)进行轮廓之间的相似性度量;有的提取目标轮廓的骨架特征,再通过形状上下文算法得到轮廓之间的相似度;有的采用基于主曲率增强距离变换的形状相似性衡量方法实现图像识别。但上述方案中均存在时间复杂度过高、识别处理速度低的技术问题,导致上述方案不适用于实时目标识别。In related technologies, some measure the similarity between contours through dynamic programming (Dynamic Programming, DP); some extract the skeleton features of the target contour, and then obtain the similarity between contours through the shape context algorithm; A shape similarity measurement method based on principal curvature enhanced distance transform for image recognition. However, there are technical problems such as high time complexity and low recognition processing speed in the above-mentioned schemes, which make the above-mentioned schemes not suitable for real-time target recognition.
发明内容Contents of the invention
本发明实施例的目的是提供一种基于质心高度增量与DTW相结合的轮廓目标识别方法,以解决相关技术中的轮廓目标识别方法存在识别处理速度低、不适用于实时目标识别的技术问题。The purpose of the embodiment of the present invention is to provide a contour target recognition method based on the combination of centroid height increment and DTW, so as to solve the technical problems that the contour target recognition method in the related art has low recognition processing speed and is not suitable for real-time target recognition .
为解决上述技术问题,本发明实施例提供如下技术方案:In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
本发明提供了一种基于质心高度增量与DTW相结合的轮廓目标识别方法,包括以下步骤:求取模板图像和目标图像的质心高度增量特征矩阵;通过DTW算法对模板图像和目标图像的质心高度增量特征矩阵进行比对,得到第一特征距离;将目标图像翻转后,求取翻转图像的质心高度增量特征矩阵;通过DTW算法对模板图像和翻转图像的质心高度增量特征矩阵进行比对,得到第二特征距离;通过最小值函数求取第一特征距离与第二特征距离中的最小特征距离;在最小特征距离中引入形状复杂度求取相似性距离,根据相似性距离输出识别结果。The invention provides a contour target recognition method based on the combination of the centroid height increment and DTW, comprising the following steps: obtaining the centroid height increment feature matrix of the template image and the target image; Compare the centroid height incremental feature matrix to obtain the first feature distance; after flipping the target image, obtain the centroid height incremental feature matrix of the flipped image; use the DTW algorithm to compare the centroid height incremental feature matrix of the template image and the flipped image Perform comparison to obtain the second feature distance; use the minimum value function to find the minimum feature distance between the first feature distance and the second feature distance; introduce shape complexity into the minimum feature distance to obtain the similarity distance, according to the similarity distance Output the recognition result.
进一步地,求取质心高度增量特征矩阵包括以下步骤:对图像进行预处理;提取图像的外围轮廓;在外围轮廓上提取多个采样点,生成轮廓采样点集;计算轮廓采样点集的轮廓质心;计算质心高度;计算质心高度增量;求取质心高度增量序列;求取质心高度增量矩阵。Further, obtaining the centroid height incremental feature matrix includes the following steps: preprocessing the image; extracting the peripheral contour of the image; extracting a plurality of sampling points on the peripheral contour to generate a contour sampling point set; calculating the contour of the contour sampling point set Centroid; calculate centroid height; calculate centroid height increment; obtain centroid height increment sequence; obtain centroid height increment matrix.
进一步地,对图像进行预处理具体包括以下步骤:将图像从三通道图像转换为单通道图像;对单通道图像进行阈值化降噪处理;提取图像的外围轮廓包括以下步骤:采用Canny微分算子对图像进行边缘提取;采用图像形态学运算膨胀细小边缘并填充空洞,形成完整的外围轮廓;再一次采用Canny微分算子进行外围轮廓的准确提取。Further, preprocessing the image specifically includes the following steps: converting the image from a three-channel image to a single-channel image; performing thresholding noise reduction processing on the single-channel image; extracting the peripheral contour of the image includes the following steps: using Canny differential operator Extract the edge of the image; use the image morphology operation to expand the thin edge and fill the hole to form a complete peripheral contour; again use the Canny differential operator to accurately extract the peripheral contour.
进一步地,在外围轮廓上提取多个采样点,生成轮廓采样点集具体包括:在外围轮廓上等间隔提取N个采样点,生成轮廓采样点集M;其中,M={mj}={m1,m2,...,mN};计算轮廓采样点集的轮廓质心具体包括:采用以下公式计算轮廓采样点集的轮廓质心Q(x0,y0): Further, extracting a plurality of sampling points on the peripheral contour, and generating a contour sampling point set specifically includes: extracting N sampling points at equal intervals on the peripheral contour, and generating a contour sampling point set M; wherein, M={m j }={ m 1 , m 2 ,..., m N }; calculating the contour centroid of the contour sampling point set specifically includes: using the following formula to calculate the contour centroid Q(x 0 , y 0 ) of the contour sampling point set:
计算质心高度具体包括:定义任一采样点mj(xj,yj)与轮廓质心Q(x0,y0)之间的欧式距离为任一采样点mj的质心高度,j=(1,2,...N);采用以下公式计算任一采样点mj(xj,yj)与轮廓质心Q(x0,y0)之间的质心高度gj:计算质心高度增量具体包括:定义任一采样点mj的质心高度gj与某一采样点mi的质心高度gi之间的差值,为任一采样点mj相对于某一采样点mi的质心高度增量hi,j,i=(1,2,...N);求取质心高度增量序列具体包括:计算全部采样点相对于某一采样点mi的质心高度增量,并将全部采样点相对于某一采样点mi的质心高度增量按采样点顺序排列,可得到采样点mi的质心高度序列Hi:Hi=(hi,i,hi,i+1,hi,N,hi,1,...hi,i+1)T;该序列包括N个元素,对应着N个采样点相对于采样点mi的质心高度增量;求取质心高度增量矩阵具体包括:将所有采样点对应的质心高度增量序列Hi按照采样点顺序排列,得到质心高度增量矩阵L(M):L(M)=(H1,H2,...,HN-1,HN)。Calculating the centroid height specifically includes: defining the Euclidean distance between any sampling point m j (x j , y j ) and the contour centroid Q(x 0 , y 0 ) as the centroid height of any sampling point m j , j=( 1, 2,...N); use the following formula to calculate the centroid height g j between any sampling point m j (x j , y j ) and the contour centroid Q(x 0 , y 0 ): The calculation of the centroid height increment specifically includes: defining the difference between the centroid height g j of any sampling point m j and the centroid height gi of a certain sampling point m i , which is any sampling point m j relative to a certain sampling point The centroid height increment hi of m i , j , i=(1, 2, ... N); obtaining the centroid height increment sequence specifically includes: calculating the centroid height of all sampling points relative to a certain sampling point mi Increment, and arrange the centroid height increments of all sampling points relative to a certain sampling point m i in the order of sampling points, and the centroid height sequence H i of sampling point mi can be obtained: H i = (h i, i , h i, i+1 , h i, N , h i, 1 ,...h i, i+1 ) T ; this sequence includes N elements, corresponding to the centroid height of N sampling points relative to sampling point m i Increment; obtaining the centroid height increment matrix specifically includes: arranging the centroid height increment sequence H i corresponding to all sampling points according to the order of the sampling points to obtain the centroid height increment matrix L (M): L (M)=(H 1 , H 2 , . . . , H N-1 , H N ).
进一步地,获取质心高度增量特征矩阵还包括以下步骤:对质心高度增量hi,j进行归一化处理,得到归一化处理后的质心高度增量 ||hi,j||为质心高度增量的模;归一化处理后的质心高度增量序列对归一化处理后的质心高度增量序列Hi加入正整数系数d,d(1<d<N);将归一化处理后的质心高度增量序列Hi划分为S个不相交的子序列[1,d]、[1+d,2d]...,其中,S=[N/d];采用以下公式计算每个子序列的质心高度增量的平均值ci,t:Further, obtaining the centroid height increment feature matrix also includes the following steps: performing normalization processing on the centroid height increment h i, j , to obtain the normalized centroid height increment ||h i, j || is the modulus of the centroid height increment; the normalized centroid height increment sequence Add a positive integer coefficient d to the centroid height increment sequence Hi after normalization processing, d (1<d<N); divide the centroid height increment sequence Hi after normalization processing into S disjoint sub- Sequence [1, d], [1+d, 2d]..., wherein, S=[N/d]; use the following formula to calculate the average value c i,t of the centroid height increment of each subsequence:
其中,t=1,2,...S;把S个均值数据进行有序排列,得到采样点mi经过平滑化处理后的特征序列Ci:Ci=(ci,1,ci,2,...,ci,S-1,ci,s)T;将所有采样点平滑处理后的质心高度增量特征序列Ci按照采样点顺序排列,得到平滑处理后的质心高度增量特征矩阵F(M):F(M)=(C1,C2,...,CN-1,CN)。Among them, t=1, 2,...S; arrange the S average value data in an orderly manner, and obtain the feature sequence C i of the sampling point m i after smoothing processing: C i =(c i, 1 , c i , 2 ,..., ci , S-1 , ci , s ) T ; the centroid height incremental feature sequence C i after smoothing all sampling points is arranged according to the order of sampling points, and the smoothed centroid height is obtained Incremental feature matrix F(M): F(M)=(C 1 , C 2 , . . . , C N-1 , C N ).
进一步地,通过DTW算法对模板图像和目标图像的质心高度增量特征矩阵进行比对,得到第一特征距离具体包括:设目标图像轮廓采样点集为M,M={m1,m2,...,mN};设模板图像轮廓采样点集为Z,Z={z1,z2,...,zN};经过归一化处理和平滑处理后得到的模板图像的质心高度增量特征矩阵记为F(Z):其中,1<r≤N;为模板图像的第r个特征矢量;经过归一化处理和平滑处理后得到的目标图像的质心高度增量特征矩阵记为F(M):/>其中,1<e<N;/>为目标图像的第e个特征矢量;将第一特征距离根据DTW算法定义为:Further, by using the DTW algorithm to compare the centroid height incremental feature matrix of the template image and the target image, obtaining the first feature distance specifically includes: setting the sample point set of the target image contour as M, M={m 1 , m 2 , ..., m N }; set the template image contour sampling point set as Z, Z={z 1 , z 2 ,..., z N }; the centroid of the template image obtained after normalization and smoothing The height increment feature matrix is denoted as F(Z): Among them, 1<r≤N; is the rth feature vector of the template image; the centroid height incremental feature matrix of the target image obtained after normalization and smoothing is denoted as F(M): /> Among them, 1<e<N;/> is the e-th feature vector of the target image; the first feature distance is defined according to the DTW algorithm as:
其中,利用以下递推公式转化为对F(M)和F(Z)子序列问题的求解:in, Use the following recursive formula to convert to the solution of F(M) and F(Z) subsequence problems:
目标图像轮廓采样点集M和模板图像轮廓采样点集Z之间的第一特征距离为:Dis(M,Z)=dDTW(F(M),F(Z))。The first characteristic distance between the target image contour sampling point set M and the template image contour sampling point set Z is: Dis(M, Z)=d DTW (F(M), F(Z)).
进一步地,通过DTW算法对模板图像和翻转图像的质心高度增量特征矩阵进行比对,得到第二特征距离具体包括:将目标图像翻转得到翻转图像;设翻转图像轮廓采样点集为Mx;目标图像的质心高度增量特征矩阵记为F(Mx);翻转图像轮廓采样点集Mx和模板图像轮廓采样点集Z之间的第二特征距离为:Dis(Mx,Z)=dDTW(F(Mx),F(Z));通过最小值函数求取第一特征距离与第二特征距离中的最小特征距离具体包括:采用以下公式计算最小特征距离:D(M,Z)=min(Dis(M,Z),Dis(Mx,Z))。Further, by using the DTW algorithm to compare the centroid height incremental feature matrix of the template image and the flipped image, obtaining the second feature distance specifically includes: flipping the target image to obtain a flipped image; setting the flipped image contour sampling point set as M x ; The centroid height incremental feature matrix of the target image is denoted as F(M x ); the second feature distance between the flipping image contour sampling point set M x and the template image contour sampling point set Z is: Dis(M x , Z)= d DTW (F(M x ), F(Z)); Calculating the minimum characteristic distance between the first characteristic distance and the second characteristic distance through the minimum value function specifically includes: using the following formula to calculate the minimum characteristic distance: D(M, Z)=min(Dis(M,Z), Dis( Mx ,Z)).
进一步地,在最小特征距离中引入形状复杂度求取相似性距离具体包括:将形状复杂度定义为:其中,std表示标准差;引入形状复杂度后采用以下公式求取相似性距离:Further, introducing the shape complexity into the minimum feature distance to obtain the similarity distance specifically includes: defining the shape complexity as: Among them, std represents the standard deviation; after introducing the shape complexity, the following formula is used to obtain the similarity distance:
进一步地,基于质心高度增量与DTW相结合的轮廓目标识别方法还包括以下步骤:建立轮廓模板库,轮廓模板库包括多个模板图像;将目标图像与轮廓模板库中的多个模板图像进行匹配,将与目标图像匹配的模板图像作为识别结果输出。Further, the contour target recognition method based on the centroid height increment combined with DTW also includes the following steps: establishing a contour template library, the contour template library includes a plurality of template images; Matching, output the template image that matches the target image as the recognition result.
进一步地,轮廓模板库内包括模板图像的原始图像以及模板图像的几何变换图像;通过对原始图像进行平移、旋转、放缩得到几何变换图像。Further, the contour template library includes the original image of the template image and the geometrically transformed image of the template image; the geometrically transformed image is obtained by translating, rotating, and scaling the original image.
相较于现有技术,本发明采用质心高度增量与DTW相结合的轮廓目标识别方法进行目标识别,DTW算法在比对目标图像和模板图像的质心高度增量矩阵的距离值时,只保留前一列的累计距离,不需要保留所有数据,从而可以降低算法的时间复杂度,从而更有利于提高识别处理速度,适用于实时目标识别;本发明还对目标图像进行了翻转,利用DTW算法对翻转图像和模板图像进行了二次识别,从而提升目标识别的准确率,避免因图像翻转导致的识别错误,并且由于DTW算法的识别处理速度较快,虽然进行了二次识别,整体运算速度依旧很快,很好地平衡了准确率和运算速率;本发明还引入了形状复杂度,进一步提升轮廓匹配效果,形状复杂度越高,轮廓局部变形的敏感度越低,这样识别出的结果越具有可信性,从而有利于提高目标识别的抗噪性。Compared with the prior art, the present invention uses a contour target recognition method combining centroid height increments and DTW for target recognition. When the DTW algorithm compares the distance values of the centroid height increment matrix of the target image and the template image, only The cumulative distance of the previous column does not need to keep all the data, thereby reducing the time complexity of the algorithm, which is more conducive to improving the recognition processing speed, and is suitable for real-time target recognition; the present invention also flips the target image, and utilizes the DTW algorithm to The flipped image and the template image are re-identified to improve the accuracy of target recognition and avoid recognition errors caused by image flipping, and because the recognition processing speed of the DTW algorithm is faster, although the second recognition is performed, the overall operation speed remains the same. Soon, the accuracy and calculation speed are well balanced; the present invention also introduces shape complexity to further improve the contour matching effect. The higher the shape complexity, the lower the sensitivity to local deformation of the contour, and the better the recognition result It is credible, which is conducive to improving the noise immunity of target recognition.
附图说明Description of drawings
通过参考附图阅读下文的详细描述,本发明示例性实施方式的上述以及其他目的、特征和优点将变得易于理解。在附图中,以示例性而非限制性的方式示出了本发明的若干实施方式,相同或对应的标号表示相同或对应的部分,其中:The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary rather than restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
图1示意性地示出了本发明可选实施例提供的基于质心高度增量与DTW相结合的轮廓目标识别方法的流程示意图;Fig. 1 schematically shows a schematic flowchart of a contour target recognition method based on a combination of centroid height increment and DTW provided by an optional embodiment of the present invention;
图2示意性地示出了本发明中目标图像与模板图像进行比对的流程图;Fig. 2 schematically shows a flow chart of comparing a target image with a template image in the present invention;
图3示意性地示出了本发明引入形状复杂度后的部分流程的流程示意图;Fig. 3 schematically shows a schematic flow diagram of a part of the process after introducing shape complexity in the present invention;
图4示意性地示出了本发明中提取图像的外围轮廓、以及在外围轮廓上提取多个采样点,生成轮廓采样点集的示意图;Fig. 4 schematically shows a schematic diagram of extracting the peripheral contour of an image and extracting a plurality of sampling points on the peripheral contour to generate a contour sampling point set in the present invention;
图5示意性地示出了不同形状的不同采样点的特征图,该特征图根据对应采样点经过平滑化处理后的特征序列Ci绘制形成;Fig. 5 schematically shows feature maps of different sampling points of different shapes, the feature maps are formed according to the smoothed feature sequence C i of the corresponding sampling points;
图6示意性地示出了目标识别结果示意图。Fig. 6 schematically shows a schematic diagram of target recognition results.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施方式。虽然附图中显示了本公开的示例性实施方式,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施方式所限制。相反,提供这些实施方式是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。若未特别指明,实施例中所用的技术手段为本领域技术人员所熟知的常规手段。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art.
需要注意的是,除非另有说明,本发明使用的技术术语或者科学术语应当为本发明所属领域技术人员所理解的通常意义。在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“连接”、“相连”等术语应作广义理解,例如,可以是固定连接,也可以是可拆卸连接,或成一体;可以是机械连接,也可以是电连接;可以是直接连接,也可以是通过中间媒介间接相连。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, unless otherwise specified, the technical terms or scientific terms used in the present invention shall have the usual meanings understood by those skilled in the art to which the present invention belongs. In this document, relational terms such as "first" and "second", etc., are only used to distinguish one entity or operation from another, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or sequence. Terms such as "connection" and "connection" should be understood in a broad sense, for example, it can be fixed connection, detachable connection, or integrated; it can be mechanical connection or electrical connection; it can be direct connection or It can be connected indirectly through an intermediary. The term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements but also other elements not expressly listed elements, or also elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the statement "comprising..." does not exclude the presence of additional same elements in the process, method, article or device comprising said element.
本发明提供了一种基于质心高度增量与DTW相结合的轮廓目标识别方法,包括以下步骤:求取模板图像和目标图像的质心高度增量特征矩阵;通过DTW算法对模板图像和目标图像的质心高度增量特征矩阵进行比对,得到第一特征距离;将目标图像翻转后,求取翻转图像的质心高度增量特征矩阵;通过DTW算法对模板图像和翻转图像的质心高度增量特征矩阵进行比对,得到第二特征距离;通过最小值函数求取第一特征距离与第二特征距离中的最小特征距离;在最小特征距离中引入形状复杂度求取相似性距离,根据相似性距离输出识别结果。The invention provides a contour target recognition method based on the combination of the centroid height increment and DTW, comprising the following steps: obtaining the centroid height increment feature matrix of the template image and the target image; Compare the centroid height incremental feature matrix to obtain the first feature distance; after flipping the target image, obtain the centroid height incremental feature matrix of the flipped image; use the DTW algorithm to compare the centroid height incremental feature matrix of the template image and the flipped image Perform comparison to obtain the second feature distance; use the minimum value function to find the minimum feature distance between the first feature distance and the second feature distance; introduce shape complexity into the minimum feature distance to obtain the similarity distance, according to the similarity distance Output the recognition result.
本发明采用DTW算法进行目标识别,DTW算法在质心高度增量矩阵中进行预算时,只保留前一列的累计距离,不需要保留所有数据,从而可以降低算法的时间复杂度,从而更有利于提高识别处理速度,适用于实时目标识别;本发明还对目标图像进行了翻转,利用DTW算法对翻转图像和模板图像进行了二次识别,从而提升目标识别的准确率,避免因图像翻转导致的识别错误,并且由于DTW算法的识别处理速度较快,虽然进行了二次识别,整体运算速度依旧很快,很好地平衡了准确率和运算速率;本发明还引入了形状复杂度,进一步提升轮廓匹配效果,形状复杂度越高,轮廓局部变形的敏感度越低,这样识别出的结果越具有可信性,从而有利于提高目标识别的抗噪性。The present invention adopts DTW algorithm to carry out target recognition, and DTW algorithm only retains the cumulative distance of the previous column when budgeting in the centroid height incremental matrix, and does not need to retain all data, thereby reducing the time complexity of the algorithm, thereby more conducive to improving Recognition processing speed, suitable for real-time target recognition; the invention also flips the target image, and uses the DTW algorithm to perform secondary recognition on the flipped image and the template image, thereby improving the accuracy of target recognition and avoiding recognition caused by image flipping error, and because the recognition processing speed of the DTW algorithm is fast, although the secondary recognition is performed, the overall calculation speed is still very fast, which balances the accuracy and calculation speed well; the present invention also introduces shape complexity to further improve the outline Matching effect, the higher the complexity of the shape, the lower the sensitivity of the local deformation of the contour, so the recognition results are more reliable, which is conducive to improving the noise resistance of target recognition.
可选地,求取质心高度增量特征矩阵包括以下步骤:对图像进行预处理;提取图像的外围轮廓;在外围轮廓上提取多个采样点,生成轮廓采样点集;计算轮廓采样点集的轮廓质心;计算质心高度;计算质心高度增量;求取质心高度增量序列;求取质心高度增量矩阵。Optionally, obtaining the centroid height incremental feature matrix includes the following steps: preprocessing the image; extracting the peripheral contour of the image; extracting a plurality of sampling points on the peripheral contour to generate a contour sampling point set; calculating the contour sampling point set Contour centroid; calculate centroid height; calculate centroid height increment; find centroid height increment sequence; find centroid height increment matrix.
可选地,对图像进行预处理具体包括以下步骤:将图像从三通道图像转换为单通道图像;对单通道图像进行阈值化降噪处理;提取图像的外围轮廓包括以下步骤:采用Canny微分算子对图像进行边缘提取;采用图像形态学运算膨胀细小边缘并填充空洞,形成完整的外围轮廓;再一次采用Canny微分算子进行外围轮廓的准确提取。Optionally, preprocessing the image specifically includes the following steps: converting the image from a three-channel image to a single-channel image; performing thresholding noise reduction processing on the single-channel image; extracting the peripheral contour of the image includes the following steps: using Canny differential algorithm Edge extraction is performed on the image; image morphology operations are used to expand the thin edges and fill holes to form a complete peripheral contour; again, the Canny differential operator is used to accurately extract the peripheral contour.
可选地,在外围轮廓上提取多个采样点,生成轮廓采样点集具体包括:在外围轮廓上等间隔提取N个采样点,生成轮廓采样点集M;其中,M={mj}={mi,m2,...,mN}。Optionally, extracting a plurality of sampling points on the peripheral contour, and generating a contour sampling point set specifically includes: extracting N sampling points at equal intervals on the peripheral contour, and generating a contour sampling point set M; wherein, M={m j }= {m i , m 2 , . . . , m N }.
可选地,计算轮廓采样点集的轮廓质心具体包括:采用以下公式计算轮廓采样点集的轮廓质心Q(x0,y0): Optionally, calculating the contour centroid of the contour sampling point set specifically includes: calculating the contour centroid Q(x 0 , y 0 ) of the contour sampling point set using the following formula:
可选地,计算质心高度具体包括:定义任一采样点mj(xj,yj)与轮廓质心Q(x0,y0)之间的欧式距离为任一采样点mj的质心高度,j=(1,2,...N);采用以下公式计算任一采样点mj(xj,yj)与轮廓质心Q(x0,y0)之间的质心高度gj: Optionally, calculating the centroid height specifically includes: defining the Euclidean distance between any sampling point m j (x j , y j ) and the contour centroid Q(x 0 , y 0 ) as the centroid height of any sampling point m j , j=(1, 2,...N); use the following formula to calculate the centroid height g j between any sampling point m j (x j , y j ) and the contour centroid Q(x 0 , y 0 ):
可选地,计算质心高度增量具体包括:定义任一采样点mj的质心高度gj与某一采样点mi的质心高度gi之间的差值,为任一采样点mj相对于某一采样点mi的质心高度增量hi,j,i=(1,2,...N);求取质心高度增量序列具体包括:计算全部采样点相对于某一采样点mi的质心高度增量,并将全部采样点相对于某一采样点mi的质心高度增量按采样点顺序排列,可得到采样点mi的质心高度序列Hi:Hi=(hi,i,hi,i+1,hi,N,hi,1,...hi,i+1)T;该序列包括N个元素,对应着N个采样点相对于采样点mi的质心高度增量。Optionally, the calculation of the centroid height increment specifically includes: defining the difference between the centroid height g j of any sampling point m j and the centroid height g i of a certain sampling point m i , which is relative to any sampling point m j The centroid height increment h i, j at a certain sampling point m i , i=(1, 2, ... N); obtaining the centroid height increment sequence specifically includes: calculating all sampling points relative to a certain sampling point The centroid height increment of m i , and the centroid height increments of all sampling points relative to a certain sampling point m i are arranged in the order of sampling points, and the centroid height sequence H i of sampling point mi can be obtained: Hi=(h i , i , h i, i+1 , h i, N , h i, 1 ,...h i, i+1 ) T ; the sequence includes N elements, corresponding to N sampling points relative to sampling point m The centroid height increment for i .
可选地,求取质心高度增量矩阵具体包括:将所有采样点对应的质心高度增量序列Hi按照采样点顺序排列,得到质心高度增量矩阵L(M):L(M)=(H1,H2,...,HN-1,HN)。Optionally, obtaining the centroid height increment matrix specifically includes: arranging the centroid height increment sequence H i corresponding to all sampling points according to the order of the sampling points to obtain the centroid height increment matrix L(M): L(M)=( H 1 , H 2 , . . . , H N-1 , H N ).
可选地,获取质心高度增量特征矩阵还包括以下步骤:对质心高度增量hi,j进行归一化处理,得到归一化处理后的质心高度增量 ||hi,j||为质心高度增量的模;归一化处理后的质心高度增量序列这样,经过归一化处理后的质心高度增量/>具有缩放不变性。Optionally, obtaining the feature matrix of the centroid height increment further includes the following steps: performing normalization processing on the centroid height increment h i, j to obtain the normalized centroid height increment ||h i, j || is the modulus of the centroid height increment; the normalized centroid height increment sequence In this way, the centroid height increment after normalization /> Has scaling invariance.
对归一化处理后的质心高度增量序列Hi加入正整数系数d,d(1<d<N);将归一化处理后的质心高度增量序列Hi划分为S个不相交的子序列[1,d]、[1+d,2d]…,其中,S=[N/d];采用以下公式计算每个子序列的质心高度增量的平均值ci,t:Add a positive integer coefficient d to the centroid height increment sequence Hi after normalization processing, d (1<d<N); divide the centroid height increment sequence Hi after normalization processing into S disjoint sub- Sequence [1,d], [1+d,2d]..., wherein, S=[N/d]; use the following formula to calculate the average value c i,t of the centroid height increment of each subsequence:
其中,t=1,2,...S;f=(t-1)×d,f为d个序列的质心高度增量,平滑后的质心高度增量为d个序列的质心高度增量求取平均值,加入d后把图像的特征矩阵平滑降维。Among them, t=1, 2,...S; f=(t-1)×d, f is the centroid height increment of d sequences, and the centroid height increment after smoothing is the centroid height increment of d sequences Calculate the average value, and after adding d, the feature matrix of the image is smoothed and reduced in dimension.
把S个均值数据进行有序排列,得到采样点mi经过平滑化处理后的特征序列Ci:Ci=(ci,1,ci,2,...,ci,S-1,ci,S)T;将所有采样点平滑处理后的质心高度增量特征序列Ci按照采样点顺序排列,得到平滑处理后的质心高度增量特征矩阵F(M):F(M)=(C1,C2,...,CN-1,CN)。经过平滑化处理后,对噪声的轮廓局部变形不会过于敏感,特征维数降低,计算更加简单,在精准性、抗噪性、简洁性之间取得了较好的折中。经过平滑处理后,不仅提高了描述符对轮廓变形以及噪声干扰的鲁棒性,同时降低了特征向量的维度,方便后续的匹配。Arrange the S mean value data in an orderly manner to obtain the feature sequence C i of the sampling point m i after smoothing processing: C i =(ci ,1 , ci,2 ,...,ci ,S-1 , ci , S ) T ; the centroid height incremental feature sequence C i after smoothing of all sampling points is arranged in the order of sampling points, and the smoothed centroid height incremental feature matrix F(M) is obtained: F(M) =(C 1 , C 2 , . . . , C N-1 , C N ). After smoothing, it will not be too sensitive to the local deformation of the contour of the noise, the feature dimension is reduced, the calculation is simpler, and a good compromise has been achieved between accuracy, noise resistance, and simplicity. After smoothing, not only the robustness of the descriptor to contour deformation and noise interference is improved, but also the dimension of the feature vector is reduced to facilitate subsequent matching.
可选地,通过DTW算法对模板图像和目标图像的质心高度增量特征矩阵进行比对,得到第一特征距离具体包括:设目标图像轮廓采样点集为M,M={m1,m2,...,mN};设模板图像轮廓采样点集为Z,Z={z1,z2,...,zN};经过归一化处理和平滑处理后得到的模板图像的质心高度增量特征矩阵记为F(Z):其中,1<r≤N;/>为模板图像的第r个特征矢量;经过归一化处理和平滑处理后得到的目标图像的质心高度增量特征矩阵记为F(M):/>其中,1<e<N;/>为目标图像的第e个特征矢量;将第一特征距离根据DTW算法定义为:Optionally, using the DTW algorithm to compare the centroid height incremental feature matrix of the template image and the target image, and obtaining the first feature distance specifically includes: setting the sample point set of the target image contour as M, M={m 1 , m 2 ,...,m N }; set the template image contour sampling point set as Z, Z={z 1 ,z 2 ,...,z N }; the template image obtained after normalization and smoothing The centroid height incremental feature matrix is denoted as F(Z): Among them, 1<r≤N;/> is the rth feature vector of the template image; the centroid height incremental feature matrix of the target image obtained after normalization and smoothing is denoted as F(M): /> Among them, 1<e<N;/> is the e-th feature vector of the target image; the first feature distance is defined according to the DTW algorithm as:
其中,利用以下递推公式转化为对F(M)和F(Z)子序列问题的求解:in, Use the following recursive formula to convert to the solution of F(M) and F(Z) subsequence problems:
目标图像轮廓采样点集M和模板图像轮廓采样点集Z之间的第一特征距离为:Dis(M,Z)=dDTW(F(M),F(Z))。这样,利用DTW算法对目标图像和模板图像进行比对,根据第一特征距离的大小,判断目标图像和模板图像是否匹配,第一特征距离越小,目标图像与模板图像越匹配。The first characteristic distance between the target image contour sampling point set M and the template image contour sampling point set Z is: Dis(M, Z)=d DTW (F(M), F(Z)). In this way, the DTW algorithm is used to compare the target image and the template image, and judge whether the target image and the template image match according to the size of the first feature distance. The smaller the first feature distance, the more the target image matches the template image.
其中,F(M)中的C1到CN为的二维矩阵,在利用DTW算法进行比对时需要对矩阵中的点特征进行比对,因此,又将F(M)=(C1,C2,...,CN-1,CN)表示为 Among them, C 1 to C N in F(M) are The two-dimensional matrix of , when using the DTW algorithm for comparison, it is necessary to compare the point features in the matrix. Therefore, F(M)=(C 1 , C 2 ,..., C N - 1 , C N ) expressed as
可选地,通过DTW算法对模板图像和翻转图像的质心高度增量特征矩阵进行比对,得到第二特征距离具体包括:将目标图像翻转得到翻转图像;设翻转图像轮廓采样点集为Mx;目标图像的质心高度增量特征矩阵记为F(Mx);翻转图像轮廓采样点集Mx和模板图像轮廓采样点集Z之间的第二特征距离为:Dis(Mx,Z)=dDTW(F(Mx),F(Z))。这样,利用DTW算法对目标图像的翻转图像和模板图像进行比对,根据第二特征距离的大小,判断目标图像的翻转图像和模板图像是否匹配,第二特征距离越小,目标图像的翻转图像与模板图像越匹配。Optionally, by using the DTW algorithm to compare the centroid height incremental feature matrix of the template image and the flipped image, obtaining the second feature distance specifically includes: flipping the target image to obtain a flipped image; setting the flipped image contour sampling point set as M x ; The centroid height increment feature matrix of the target image is denoted as F(M x ); The second feature distance between the flipping image contour sampling point set M x and the template image contour sampling point set Z is: Dis(M x , Z) =d DTW (F(M x ), F(Z)). In this way, use the DTW algorithm to compare the flipped image of the target image with the template image, and judge whether the flipped image of the target image matches the template image according to the size of the second feature distance. The smaller the second feature distance, the smaller the flipped image of the target image The closer it matches the template image.
可选地,通过最小值函数求取第一特征距离与第二特征距离中的最小特征距离具体包括:采用以下公式计算最小特征距离:Optionally, calculating the minimum characteristic distance between the first characteristic distance and the second characteristic distance through the minimum value function specifically includes: calculating the minimum characteristic distance by using the following formula:
D(M,Z)=min(Dis(M,Z),Dis(Mx,Z))。D(M,Z)=min(Dis(M,Z), Dis(M x ,Z)).
这样,根据最小特征距离判断待测目标与模板图像是否匹配,最小特征距离越小,待测目标与模板图像越匹配。将待测目标的翻转图像与模板图像进行二次匹配,可以提升匹配准确率。In this way, it is judged whether the target to be tested matches the template image according to the minimum feature distance, and the smaller the minimum feature distance is, the more the target to be tested matches the template image. Matching the flip image of the target to be tested with the template image twice can improve the matching accuracy.
可选地,待测目标的翻转图像的获取可以通过对目标图像进行翻转得到。Optionally, the flipped image of the target to be measured can be obtained by flipping the target image.
可选地,在最小特征距离中引入形状复杂度求取相似性距离具体包括:将形状复杂度定义为:其中,std表示标准差;引入形状复杂度后采用以下公式求取相似性距离:Optionally, introducing the shape complexity into the minimum feature distance to obtain the similarity distance specifically includes: defining the shape complexity as: Among them, std represents the standard deviation; after introducing the shape complexity, the following formula is used to obtain the similarity distance:
这样,引入形状复杂度,可以提升轮廓目标识别方法的抗噪性,进一步提升匹配效果。引入形状复杂度后,形状复杂度越高,轮廓局部变形的敏感度越低,识别出的结果越具有可信性。In this way, the introduction of shape complexity can improve the noise resistance of the contour target recognition method and further improve the matching effect. After the shape complexity is introduced, the higher the shape complexity, the lower the sensitivity to local deformation of the contour, and the more reliable the recognition result is.
可选地,基于质心高度增量与DTW相结合的轮廓目标识别方法还包括以下步骤:建立轮廓模板库,轮廓模板库包括多个模板图像;将目标图像与轮廓模板库中的多个模板图像进行匹配,将与目标图像匹配的模板图像作为识别结果输出。其中,模板图像为确定物体图像,目标图像为不确定物体图像,通过本申请的轮廓目标识别方法,可识别出目标图像的物体种类。Optionally, the contour target recognition method based on the centroid height increment combined with DTW also includes the following steps: setting up a contour template library, which includes a plurality of template images; combining the target image with a plurality of template images in the contour template library Matching is performed, and the template image matched with the target image is output as the recognition result. Wherein, the template image is an image of a certain object, and the target image is an image of an uncertain object, and the object type of the target image can be identified through the outline object recognition method of the present application.
可选地,轮廓模板库内包括模板图像的原始图像以及模板图像的几何变换图像;通过对原始图像进行平移、旋转、放缩得到几何变换图像。这样,使本申请提供的技术方案具有平移、旋转、放缩不变性。Optionally, the contour template library includes the original image of the template image and the geometrically transformed image of the template image; the geometrically transformed image is obtained by translating, rotating, and scaling the original image. In this way, the technical solution provided by the present application has translation, rotation, and scaling invariance.
下面结合图1至图6,对本申请的可选具体实施例进行详细描述。An optional specific embodiment of the present application will be described in detail below with reference to FIG. 1 to FIG. 6 .
如图1所示,本申请提供的可选具体实施例中的基于质心高度增量与DTW相结合的轮廓目标识别方法包括以下步骤:As shown in Figure 1, the contour target recognition method based on the combination of centroid height increment and DTW in the optional specific embodiment provided by the present application includes the following steps:
(1)图像的预处理及轮廓提取:对待测目标图像和若干模板图像进行预处理并用轮廓提取算法提取各自的外围轮廓。其中,待测目标为不确定物体图像,模板图像为确定物体图像。(1) Image preprocessing and contour extraction: Preprocess the target image and several template images and extract their respective peripheral contours with contour extraction algorithms. Wherein, the target to be tested is an image of an uncertain object, and the template image is an image of a certain object.
(2)对轮廓进行均匀采样和质心提取:提取待测目标的外部轮廓,在外部轮廓上选取N个采样点,提取N个采样点的轮廓质心。以轮廓质心为参考点,根据其他点相较于该点的高度关系建立质心高度增量描述符:对选取的采样点求取他们各自与质心的距离以及质心高度增量。(2) Perform uniform sampling and centroid extraction on the contour: extract the outer contour of the target to be measured, select N sampling points on the outer contour, and extract the contour centroid of the N sampling points. With the contour centroid as a reference point, the centroid height increment descriptor is established according to the height relationship of other points compared with this point: for the selected sampling points, their respective distances from the centroid and the centroid height increment are calculated.
(3)对质心高度增量特征进行归一化和平滑化处理:对步骤(2)得到的质心高度增量特征降维处理以及使其具备平移旋转不变性。(3) Normalize and smooth the centroid height incremental feature: reduce the dimensionality of the centroid height incremental feature obtained in step (2) and make it invariant to translation and rotation.
(4)采用DTW算法计算两个轮廓的特征距离:应用步骤(3)得到的经过处理的质心高度增量特征计算匹配代价进而计算轮廓之间的特征距离。(4) Use the DTW algorithm to calculate the feature distance of two contours: use the processed centroid height incremental feature obtained in step (3) to calculate the matching cost and then calculate the feature distance between the contours.
(5)将目标图像进行翻转与模板库图像进行二次比对,并应用最小值函数求取最小相似性距离,得到初次识别结果,然后联合形状复杂度分析再次对目标图像进行识别,得出最终的识别结果。(5) Flip the target image and compare it with the template library image twice, and apply the minimum value function to find the minimum similarity distance to obtain the initial recognition result, and then combine the shape complexity analysis to recognize the target image again, and get The final recognition result.
其中步骤(1)包括如下步骤(1.1)~(1.5):Wherein step (1) includes the following steps (1.1) to (1.5):
(1.1)图像从三通道转化为单通道图像;(1.1) The image is converted from a three-channel image to a single-channel image;
(1.2)对图像进行阈值化降噪处理;(1.2) Thresholding and denoising the image;
(1.3)采用Canny微分算子对图像进行边缘的提取;(1.3) using Canny differential operator to extract the edge of the image;
(1.4)采用图像形态学运算膨胀细小边缘并填充空洞,形成完整的外围轮廓;(1.4) Use image morphological operations to expand the thin edges and fill the holes to form a complete peripheral outline;
(1.5)再一次采用Canny微分算子进行外围轮廓的准确提取。(1.5) The Canny differential operator is used again to accurately extract the peripheral contour.
其中步骤(2)包括如下步骤(2.1)~(2.2):The step (2) includes the following steps (2.1) to (2.2):
(2.1)在图像外部轮廓上提取N个有效特征点;(2.1) Extract N valid feature points on the image outer contour;
(2.2)根据算法计算轮廓质心;(2.2) Calculate the contour centroid according to the algorithm;
(2.3)求出采样点与质心的距离,即质心高度值;(2.3) Find the distance between the sampling point and the center of mass, i.e. the height of the center of mass;
(2.4)对质心高度增量序列的求取;(2.4) Obtaining the centroid height increment sequence;
(2.5)对质心高度增量矩阵的求取;(2.5) Finding of centroid height increment matrix;
如图4(a)(b),步骤(2.1)中轮廓特征点的提取是进行的等间隔取样,选取一定数目的轮廓点。包括如下步骤:图像轮廓提取的完整轮廓点集,选取轮廓点的数目为N,用总轮廓点数m除以所需要的点的数量N,可以得到轮廓的取样距离m/N,选取轮廓点的起点可以是随机的。由此可以得出取样点N的数量越大,描述出来的形状也就更准确。As shown in Figure 4(a)(b), the extraction of contour feature points in step (2.1) is sampling at equal intervals, and a certain number of contour points are selected. Including the following steps: extracting the complete contour point set of the image contour, selecting the number of contour points as N, dividing the total contour point m by the required number of points N, the sampling distance m/N of the contour can be obtained, and selecting the contour point The starting point can be random. From this, it can be concluded that the larger the number of sampling points N is, the more accurate the described shape will be.
如图4(c),步骤(2.2)利用步骤(2.1)得到轮廓部分点集记为M={mi}={m1,m2,...,mN},其中N为采样点的个数,mi为轮廓第i个采样点。设采样点mi(xi,yi),轮廓质心Q(x0,y0)的计算公式如下:As shown in Figure 4(c), step (2.2) utilizes step (2.1) to obtain the point set of the contour part as M={m i }={m 1 , m 2 ,..., m N }, where N is the sampling point The number of , m i is the i-th sampling point of the contour. Assuming the sampling point m i ( xi , y i ), the calculation formula of the contour centroid Q(x 0 , y 0 ) is as follows:
步骤(2.3)要计算轮廓的质心高度增量,最重要的是求出采样点与质心的距离,即质心高度值,该值表征了采样点在轮廓上的位置,对于采样点mi(xi,yi),定义质心高度gi为该点与质心Q(x0,y0)的欧氏距离,即:Step (2.3) is to calculate the centroid height increment of the contour. The most important thing is to find the distance between the sampling point and the centroid, that is, the centroid height value, which represents the position of the sampling point on the contour. For the sampling point m i (x i , y i ), define the centroid height g i as the Euclidean distance between the point and the centroid Q(x 0 , y 0 ), that is:
如图5所示,给出了带标记轮廓以及轮廓不同采样点A、B、C的特征图,该特征图根据对应采样点经过平滑化处理后的特征序列Ci绘制形成,从中可证实同一轮廓不同采样点的差异性。As shown in Figure 5, the marked contour and the feature map of different sampling points A, B, and C of the contour are given. The feature map is formed according to the smoothed feature sequence C i of the corresponding sampling points, from which it can be verified that the same The difference of different sampling points of the contour.
步骤(2.4)对质心高度增量序列的求取,将所有采样点相对于点mi的质心高度增量按轮廓点顺序排列,得到采样点mi的质心高度增量序列Hi,即:In step (2.4) to obtain the centroid height increment sequence, the centroid height increments of all sampling points relative to point mi are arranged in the order of contour points, and the centroid height increment sequence H i of sampling point mi is obtained, namely:
Hi=(hi,i,hi,i+1,..hi,N,hi,1,..hi,i-1)T;H i = (h i, i , h i, i+1 , .. h i, N , h i, 1 , .. h i, i-1 ) T ;
如图4,步骤(2.5)对质心高度增量矩阵的求取,将形状轮廓M上每个点对应的质心高度增量序列Hi按照轮廓点顺序排列,得到一个尺寸为N′N的矩阵:As shown in Figure 4, step (2.5) calculates the centroid height increment matrix, arranges the centroid height increment sequence H i corresponding to each point on the shape contour M according to the order of the contour points, and obtains a matrix with a size of N′N :
L(M)=(H1,H2,...,HN-1,HN);L(M)=(H 1 , H 2 , . . . , H N-1 , H N );
式中L(M)表示轮廓的质心高度增量矩阵,矩阵的第i列表示轮廓M上采样点mi的质心高度增量描述符。该描述符描述了轮廓点与点之间的相对高度关系,不随轮廓的旋转和平移而变化。where L(M) represents the centroid height increment matrix of the contour, and the i-th column of the matrix represents the centroid height increment descriptor of the sampling point m i on the contour M. This descriptor describes the relative height relationship between contour points and points, which does not change with the rotation and translation of the contour.
步骤(3)中对对质心高度增量特征进行归一化和平滑化处理包括如下步骤:In step (3), normalizing and smoothing the centroid height incremental feature includes the following steps:
为使该描述符具有缩放不变性,我们对矩阵的每一行进行归一化处理:To make this descriptor scale-invariant, we normalize each row of the matrix:
式中||ht,j||为质心高度增量数据的模。该式定义了采样点mi相对于轮廓所有采样点的质心高度增量,这样虽然有效的描述了轮廓信息,但对噪声引起的轮廓局部变形过于敏感,同时特征维数过高、计算复杂,在此采用平滑的策略,在描述符的精确性、抗噪性、简洁性之间取得一个很好的折中,具体过程如下:where ||h t, j || is the modulus of the centroid height incremental data. This formula defines the centroid height increment of the sampling point mi relative to all sampling points of the contour, which effectively describes the contour information, but is too sensitive to the local deformation of the contour caused by noise, and the feature dimension is too high and the calculation is complicated. Here, a smooth strategy is adopted to achieve a good compromise between the accuracy, noise resistance, and simplicity of the descriptor. The specific process is as follows:
对于mi点的质心高度增量可表示为:The centroid height increment of point mi can be expressed as:
该序列包含了N个元素,对应N个采样点相对于该点的质心高度增量,加入正整数系数d(1<d<N),将该序列划分成S个不相交的子序列[1,d]、[1+d,2d]...,其中S=[N/d],计算每个序列的质心高度增量的平均值:The sequence contains N elements, corresponding to the centroid height increment of N sampling points relative to the point, adding a positive integer coefficient d (1<d<N), dividing the sequence into S disjoint subsequences [1 , d], [1+d, 2d]..., where S=[N/d], calculate the average of the centroid height increments for each sequence:
式中t=1,2,...S。把S个均值数据进行有序排列,得到点mi经过平滑化处理后的特征序列Ci,即:Ci=(ci,1,ci,2,...,ci,S-1,ci,s)T;In the formula, t=1, 2, ... S. Arrange the S mean value data in an orderly manner to obtain the feature sequence C i of point m i after smoothing processing, namely: C i =(ci ,1 , ci,2 ,...,ci ,S- 1 , c i, s ) T ;
经过平滑处理后,不仅提高了描述符对轮廓变形以及噪声干扰的鲁棒性,同时降低了特征向量的维度,方便后续的匹配。将所有采样点平滑后的描述符按序排列,得到轮廓M的质心高度增量特征矩阵F(M):After smoothing, not only the robustness of the descriptor to contour deformation and noise interference is improved, but also the dimension of the feature vector is reduced to facilitate subsequent matching. Arrange the smoothed descriptors of all sampling points in order to obtain the centroid height incremental feature matrix F(M) of the contour M:
F(M)=(C1,C2,...,CN-1,CN);F(M)=(C 1 , C 2 , . . . , C N-1 , C N );
步骤(4)采用DTW算法计算两个轮廓的特征距离包括如下步骤:Step (4) adopting the DTW algorithm to calculate the feature distance of the two contours includes the following steps:
如图2和图3所示,在步骤(2)获取形状的特征描述符后,计算两个形状的相似程度,由于质心高度增量描述符包含轮廓点集顺序这一全局特征,本文选取了DTW算法对得到的形状特征进行匹配。As shown in Figure 2 and Figure 3, after the feature descriptor of the shape is obtained in step (2), the similarity between the two shapes is calculated. Since the centroid height increment descriptor contains the global feature of the contour point set order, this paper selects The DTW algorithm matches the obtained shape features.
DTW算法采用动态规划思想,将求取目标轮廓和模板轮廓相似性的问题转化为对两轮廓点之间的最短路径规划问题求解。不同轮廓采样点之间的特征越相似,相应的路径距离就越小。设目标轮廓点集M={m1,m2,...,mN}和模板图像轮廓点集Z={z1,z2,...,zN},分别对其提取质心高度增量特征,得到质心高度增量矩阵F(M)和F(Z)。假设目标轮廓的特征矩阵The DTW algorithm adopts the idea of dynamic programming, and transforms the problem of finding the similarity between the target contour and the template contour into the shortest path planning problem between the two contour points. The more similar the features between different contour sampling points, the smaller the corresponding path distance. Set the target contour point set M={m 1 ,m 2 ,...,m N } and the template image contour point set Z={z 1 ,z 2 ,...,z N }, extract the centroid height Incremental feature, get centroid height incremental matrix F(M) and F(Z). Eigenmatrix of hypothesized object contours
其中,1<e<N;,模板图像的特征矩阵其中,1<r≤N;,其中/>和/>分别代表目标图像的第e个和模板图像的第r个特征矢量。则两个形状的相似性距离差异根据DTW算法定义为: Among them, 1<e<N;, the feature matrix of the template image where, 1<r≤N; where /> and /> represent the e-th feature vector of the target image and the r-th feature vector of the template image, respectively. Then the similarity distance difference between two shapes is defined according to the DTW algorithm as:
式中 In the formula
DTW算法采用动态规划思想,利用下方递推公式将以上问题转化为对F(M)和F(Z)子序列问题的求解:The DTW algorithm adopts the idea of dynamic programming, and uses the following recursive formula to transform the above problem into the solution of the F(M) and F(Z) subsequence problems:
即轮廓M和Z之间的相似性距离为:That is, the similarity distance between contours M and Z is:
Dis(M,Z)=dDTW(F(M),F(Z));Dis(M,Z)=d DTW (F(M),F(Z));
步骤(5)中,具体包括以下步骤:In step (5), specifically comprise the following steps:
(5.1)翻转目标图像与模板图像进行二次匹配,应用最小值函数求取两次比对中的最小轮廓间距离。(5.1) Flip the target image and the template image for secondary matching, and apply the minimum value function to obtain the minimum distance between contours in the two comparisons.
如图2所示,步骤(5.1)中由于在图像识别过程中,经常会出现待识别目标存在翻转的情况,增加了误匹配的概率。因此将待识别图像轮廓M翻转得到Mx,将形状Mx和形状Z匹配得到它们之间的距离:As shown in Fig. 2, in the step (5.1), the target to be recognized often appears to be flipped during the image recognition process, which increases the probability of false matching. Therefore, the contour M of the image to be recognized is flipped to obtain M x , and the shape M x and shape Z are matched to obtain the distance between them:
Dis(Mx,Z)=dDTW(F(Mx),F(Z))Dis(M x , Z)=d DTW (F(M x ), F(Z))
(5.2)联合形状复杂度分析得出最终识别结果。(5.2) Combined shape complexity analysis to get the final recognition result.
如图6所示,步骤(5.2)中由于形状的复杂度越高,对轮廓局部变形的敏感度越低,识别出的结果越具有可信性,因此引入形状复杂度进一步提升轮廓的匹配效果,定义形状轮廓的复杂度为:As shown in Figure 6, in step (5.2), the higher the complexity of the shape, the lower the sensitivity to the local deformation of the contour, and the more reliable the recognition result is, so the introduction of shape complexity further improves the matching effect of the contour , the complexity of defining the shape profile is:
式中std表示标准差。通过引入形状复杂度最终得到两个形状之间的相似性距离Q(M,Z):where std stands for standard deviation. By introducing shape complexity, the similarity distance Q(M, Z) between two shapes is finally obtained:
式中Q(M)和Q(Z)分别为形状M和Z的复杂度。where Q(M) and Q(Z) are the complexity of shapes M and Z, respectively.
针对基于轮廓特征的目标识别问题,本申请提出的基于质心高度增量与DTW相结合的轮廓目标识别方法,将质心高度增量特征描述符与DTW相似性度量算法相结合,首先对目标轮廓均匀提取采样点,并对目标图像以及模板图像轮廓点的质心高度增量特征进行提取,然后使用DTW算法寻找规整路径的方法对目标图像以及模板图像的特征矩阵进行相似性度量,最后结合轮廓的形状复杂度分析获得最终的识别结果。该方法能够保证识别率优于大多数常见的传统目标识别算法的同时,提升目标识别的实时性。Aiming at the target recognition problem based on contour features, this application proposes a contour target recognition method based on the combination of centroid height increment and DTW, which combines the centroid height increment feature descriptor with the DTW similarity measurement algorithm. Extract the sampling points, and extract the centroid height incremental features of the target image and the contour points of the template image, and then use the DTW algorithm to find a regular path to measure the similarity of the feature matrix of the target image and the template image, and finally combine the shape of the contour Complexity analysis obtains the final recognition result. This method can ensure that the recognition rate is better than most common traditional target recognition algorithms, and at the same time improve the real-time performance of target recognition.
本申请优选实施例提供的基于质心高度增量与DTW相结合的轮廓目标识别方法包括下列步骤:建立多类目标图像和模板图像的轮廓模板库;对模板图像和目标图像分别进行图像预处理及外围轮廓提取,并生成轮廓点集;对模板图像和目标图像分别提取轮廓的质心高度增量特征,并进行归一化处理和平滑化处理;通过DTW算法计算模板图像和目标图像的质心高度增量特征距离;将目标图像进行翻转与模板库图像进行二次比对,并应用最小值函数求取最小相似性距离,得到初次识别结果,然后联合形状复杂度分析再次对目标图像进行识别,得出最终的识别结果。The contour target recognition method based on the combination of centroid height increment and DTW provided by the preferred embodiment of the present application includes the following steps: establishing a contour template library of multiple types of target images and template images; performing image preprocessing and The peripheral contour is extracted, and a contour point set is generated; the centroid height increment feature of the contour is extracted from the template image and the target image respectively, and normalized and smoothed; the centroid height increment of the template image and the target image is calculated by the DTW algorithm. Measure the feature distance; flip the target image and compare it with the template library image twice, and use the minimum value function to find the minimum similarity distance to obtain the initial recognition result, and then combine the shape complexity analysis to recognize the target image again, and get the final recognition result.
优选的,轮廓模板库内具体包括图像的几何变换特征和完整的图像特征。Preferably, the contour template library specifically includes geometric transformation features and complete image features of the image.
优选的,图像预处理及外围轮廓提取具体包括以下步骤:图像从三通道转化为单通道图像;对图像进行阈值化降噪处理;采用Canny微分算子对图像进行边缘的提取;采用图像形态学运算膨胀细小边缘并填充空洞,形成完整的外围轮廓;再一次采用Canny微分算子进行外围轮廓的准确提取。Preferably, image preprocessing and peripheral contour extraction specifically include the following steps: the image is converted from a three-channel image to a single-channel image; the image is thresholded for noise reduction; the Canny differential operator is used to extract the edge of the image; The operation expands the thin edge and fills the hole to form a complete peripheral contour; again, the Canny differential operator is used to accurately extract the peripheral contour.
优选的,提取轮廓的质心高度增量特征,并进行归一化处理和平滑化处理具体包括以下步骤:求取轮廓质心;通过特征提取算法提取出目标图像的质心高度增量特征:求出N个点得质心高度,再求出N个点的质心高度增量,应用轮廓顺序排列任意采样点的质心高度增量得到质心高度增量序列,进而得到N个点的质心高度增量序列构成的质心高度增量矩阵;对轮廓采样点的质心高度增量特征进行归一化处理;对轮廓采样点的质心高度增量特征进行平滑性处理。Preferably, extracting the centroid height incremental feature of the contour, and performing normalization processing and smoothing processing specifically includes the following steps: obtaining the contour centroid; extracting the centroid height incremental feature of the target image through a feature extraction algorithm: finding N The centroid height of each point is obtained, and then the centroid height increment of N points is calculated, and the centroid height increment of any sampling point is arranged in contour sequence to obtain the centroid height increment sequence, and then the centroid height increment sequence of N points is obtained. The centroid height increment matrix; normalize the centroid height increment feature of the contour sampling points; perform smoothing processing on the centroid height increment features of the contour sampling points.
优选的,通过DTW算法计算模板图像和目标图像的质心高度增量特征距离具体包括以下步骤:使用DTW算法量化目标轮廓和模板轮廓采样点之间质心高度增量特征的相似性。DTW算法将求取两个轮廓之间相似度的总问题转化为求取轮廓点之间相似度的分问题。Preferably, calculating the centroid height incremental feature distance between the template image and the target image through the DTW algorithm specifically includes the following steps: using the DTW algorithm to quantify the similarity of the centroid height incremental feature between the sampling points of the target contour and the template contour. The DTW algorithm transforms the general problem of obtaining the similarity between two contours into a sub-problem of obtaining the similarity between contour points.
本发明优选实施例提供的基于质心高度增量与DTW的轮廓目标识别方法,属于机器视觉与目标检测技术领域,解决了现有技术中识别处理速度低,如何平衡识别的速率与准确率的问题。对模板图像和待识别图像进行预处理和轮廓提取,对轮廓进行均匀采样和求取质心,以轮廓质心为参考点,根据其他采样点相对于该点的高度关系构建质心高度增量描述符,对质心高度增量特征进行归一化处理和平滑化处理;采用DTW算法得出两个轮廓的特征距离,然后翻转目标图像进行二次识别,定义最小值函数得到两次识别中最短相似性距离,最后结合轮廓特征的复杂度分析筛选出最终的识别结果。本发明将质心高度增量的轮廓描述方法与DTW算法相结合,可以保证在识别率效果较好的同时,提升目标识别的实时性。The contour target recognition method based on centroid height increment and DTW provided by the preferred embodiment of the present invention belongs to the technical field of machine vision and target detection, and solves the problem of how to balance the speed and accuracy of recognition in the prior art due to the low speed of recognition processing . Perform preprocessing and contour extraction on the template image and the image to be recognized, uniformly sample the contour and calculate the centroid, use the contour centroid as a reference point, and construct a centroid height incremental descriptor according to the height relationship of other sampling points relative to this point, Normalize and smooth the centroid height incremental features; use the DTW algorithm to obtain the feature distance of the two contours, then flip the target image for secondary recognition, define the minimum function to obtain the shortest similarity distance in the two recognitions , and finally combined with the complexity analysis of contour features to screen out the final recognition results. The present invention combines the contour description method of centroid height increments with the DTW algorithm, which can ensure a good recognition rate effect and improve the real-time performance of target recognition.
本发明的有益技术效果至少包括:在传统轮廓目标算法识别准确率低、复杂度高情况下,本发明考虑将具有空间关系的质心高度增量特征描述符与DTW算法相结合,在识别过程中通过平滑减小特征维数从而减小算法复杂度。在目标识别准确率低的情况下,考虑翻转目标图像进行二次识别并结合形状复杂度提高目标形状的识别准确率和抗燥性。The beneficial technical effects of the present invention at least include: in the case of low recognition accuracy and high complexity of the traditional contour target algorithm, the present invention considers combining the centroid height incremental feature descriptor with spatial relationship with the DTW algorithm, during the recognition process The complexity of the algorithm is reduced by smoothly reducing the feature dimension. In the case of low target recognition accuracy, consider flipping the target image for secondary recognition and combine shape complexity to improve target shape recognition accuracy and anti-noise.
经实验验证,本申请的检索率可达90%以上,相比于现有的轮廓识别算法,具有较高的检索率。此外,本申请的总时间复杂度为O(N2)+O(N2),该数值明显低于现有的轮廓识别算法的时间复杂度O(N2)+O(N3)。本申请提供的技术方案在保证良好的检索率的情况下能够有效提升目标识别的实时性,很好地平衡了效率和准确率,整体性能更佳。It is verified by experiments that the retrieval rate of the present application can reach more than 90%, which is higher than the existing contour recognition algorithm. In addition, the total time complexity of the present application is O(N 2 )+O(N 2 ), which is significantly lower than the time complexity O(N 2 )+O(N 3 ) of the existing contour recognition algorithm. The technical solution provided by this application can effectively improve the real-time performance of target recognition while ensuring a good retrieval rate, balance efficiency and accuracy well, and have better overall performance.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310702710.8A CN116704220A (en) | 2023-06-14 | 2023-06-14 | A Contour Target Recognition Method Based on the Combination of Centroid Height Increment and DTW |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310702710.8A CN116704220A (en) | 2023-06-14 | 2023-06-14 | A Contour Target Recognition Method Based on the Combination of Centroid Height Increment and DTW |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116704220A true CN116704220A (en) | 2023-09-05 |
Family
ID=87830811
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310702710.8A Pending CN116704220A (en) | 2023-06-14 | 2023-06-14 | A Contour Target Recognition Method Based on the Combination of Centroid Height Increment and DTW |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116704220A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118608811A (en) * | 2024-08-08 | 2024-09-06 | 广州市合熠智能科技股份有限公司 | Integrated AI intelligent image recognition sensor contour recognition method |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160110627A1 (en) * | 2013-04-01 | 2016-04-21 | Aselsan Elektronik Sanayi Ve Ticaret Anonim Sirket | System and method for describing image outlines |
-
2023
- 2023-06-14 CN CN202310702710.8A patent/CN116704220A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160110627A1 (en) * | 2013-04-01 | 2016-04-21 | Aselsan Elektronik Sanayi Ve Ticaret Anonim Sirket | System and method for describing image outlines |
Non-Patent Citations (1)
Title |
---|
郑伟: "基于目标轮廓特征的图像识别算法研究", CNKI硕士论文, 15 February 2023 (2023-02-15), pages 1 - 32 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118608811A (en) * | 2024-08-08 | 2024-09-06 | 广州市合熠智能科技股份有限公司 | Integrated AI intelligent image recognition sensor contour recognition method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105956582B (en) | A kind of face identification system based on three-dimensional data | |
CN106355577B (en) | Fast Image Matching Method and System Based on Feature State and Global Consistency | |
CN108596197B (en) | Seal matching method and device | |
CN107862708A (en) | A kind of SAR and visible light image registration method | |
CN101650784B (en) | Method for matching images by utilizing structural context characteristics | |
CN104167003A (en) | Method for fast registering remote-sensing image | |
CN103136751A (en) | Improved scale invariant feature transform (SIFT) image feature matching algorithm | |
CN108346162A (en) | Remote sensing image registration method based on structural information and space constraint | |
CN103632142A (en) | Image Matching Method Based on Feature Description of Local Coordinate System | |
CN105512599A (en) | Face identification method and face identification system | |
CN110738222B (en) | Image matching method and device, computer equipment and storage medium | |
CN103955950B (en) | Image tracking method utilizing key point feature matching | |
CN115564808B (en) | Multi-resolution hyperspectral/SAR image registration method based on public space-spectrum subspace | |
CN105160686A (en) | Improved scale invariant feature transformation (SIFT) operator based low altitude multi-view remote-sensing image matching method | |
CN115690803B (en) | Digital image recognition method, device, electronic device and readable storage medium | |
CN111199558A (en) | Image matching method based on deep learning | |
CN110427997A (en) | Improvement CVA change detecting method towards complicated remote sensing image background | |
CN108537832A (en) | Method for registering images, image processing system based on local invariant gray feature | |
CN104933407A (en) | Fingerprint recognition method based on SIFT | |
CN109934298B (en) | Progressive graph matching method and device of deformation graph based on clustering | |
Feng et al. | Detecting locally, patching globally: An end-to-end framework for high speed and accurate detection of fingerprint minutiae | |
CN114022914A (en) | Palmprint Recognition Method Based on Fusion Deep Network | |
CN116704220A (en) | A Contour Target Recognition Method Based on the Combination of Centroid Height Increment and DTW | |
CN110163182A (en) | A kind of hand back vein identification method based on KAZE feature | |
CN114820673A (en) | Target identification method based on profile centroid height increment characteristics |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |