A contour object recognition method based on centroid height increment and DTW combination
By combining centroid height increment with DTW, the problem of slow contour target recognition speed is solved, achieving high efficiency and accuracy in real-time target recognition, reducing algorithm complexity and improving noise resistance.
Patent Information
- Application Number
- CN202310702710.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-14
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2043-06-14
AI Technical Summary
Existing contour target recognition methods suffer from slow recognition and processing speeds, making them unsuitable for real-time target recognition.
A method combining centroid height increment and dynamic time normalization (DTW) is adopted. By obtaining the centroid height increment feature matrix of the template image and the target image, the DTW algorithm is used for comparison. During the comparison process, only the cumulative distance of the first column is retained. The flipped image is combined for secondary recognition, and shape complexity is introduced to improve the recognition accuracy.
It improves the recognition and processing speed, is suitable for real-time target recognition, and enhances the recognition accuracy and noise resistance, while reducing the time complexity of the algorithm and reducing recognition errors.
Smart Images

Figure CN116704220B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target recognition technology, and in particular to a contour target recognition method based on a combination of centroid height increment and DTW. Background Technology
[0002] In the field of object recognition, shape is an effective and frequently used feature in object matching. Common shape representation methods include contour-based shape representation, region-based shape representation, and skeleton-based shape representation. Contours, due to their richer information content, resistance to changes in lighting, object color, and texture, and ability to effectively describe large-scale object structures, are increasingly being used in object recognition methods.
[0003] Among related technologies, some use dynamic programming (DP) algorithms to measure the similarity between contours; some extract the skeleton features of the target contours and then obtain the similarity between contours through shape context algorithms; and some use shape similarity measurement methods based on principal curvature enhanced distance transformation to achieve image recognition. However, all of the above schemes suffer from technical problems such as high time complexity and low recognition processing speed, making them unsuitable for real-time target recognition. Summary of the Invention
[0004] The purpose of this 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 of low recognition processing speed and unsuitability for real-time target recognition in related technologies.
[0005] To address the aforementioned technical problems, the embodiments of the present invention provide the following technical solutions:
[0006] This invention provides a contour target recognition method based on a combination of centroid height increment and DTW (Dynamic Depth-Warping), comprising the following steps: obtaining the centroid height increment feature matrices of a template image and a target image; comparing the centroid height increment feature matrices of the template image and the target image using the DTW algorithm to obtain a first feature distance; flipping the target image and obtaining the centroid height increment feature matrix of the flipped image; comparing the centroid height increment feature matrices of the template image and the flipped image using the DTW algorithm to obtain a second feature distance; finding the minimum feature distance between the first feature distance and the second feature distance using a minimum value function; introducing shape complexity into the minimum feature distance to obtain a similarity distance; and outputting the recognition result based on the similarity distance.
[0007] Further, obtaining the centroid height increment feature matrix includes the following steps: preprocessing the image; extracting the outer contour of the image; extracting multiple sampling points on the outer contour to generate a contour sampling point set; calculating the contour centroid of the contour sampling point set; calculating the centroid height; calculating the centroid height increment; obtaining the centroid height increment sequence; and obtaining the centroid height increment matrix.
[0008] Further, the image preprocessing specifically includes the following steps: converting the image from a three-channel image to a single-channel image; performing thresholding noise reduction on the single-channel image; and extracting the outer contour of the image, including the following steps: using the Canny differential operator to extract the image edges; using image morphology operations to dilate small edges and fill holes to form a complete outer contour; and using the Canny differential operator again to accurately extract the outer contour.
[0009] Furthermore, extracting multiple sampling points on the outer contour to generate a contour sampling point set specifically includes: extracting N sampling points at equal intervals on the outer contour to generate a contour sampling point set M; where M = {m j}={m1,m2,...,m N The calculation of the centroid of the contour sampling point set specifically includes: calculating the centroid Q(x0, y0) of the contour sampling point set using the following formula:
[0010] Calculating the centroid height specifically includes: defining any sampling point m j (x j y j The Euclidean distance between any sampling point m and the centroid Q(x0, y0) is given by the distance between the sampling point m and the centroid Q(x0, y0). j The centroid height, j = (1, 2, ... N); calculate the height of any sampling point m using the following formula. j (x j y j The centroid height g between the centroid of the profile Q(x0, y0) and the centroid of the profile Q(x0, y0) j : Calculating the centroid height increment specifically includes: defining any sampling point m j The height of the center of mass g j With a certain sampling point m i The difference between the centroid heights gi and m at any sampling point is given by the value of m. j Relative to a certain sampling point m i The increment of the centroid height h i,j , i = (1, 2, ... N); obtaining the centroid height increment sequence specifically includes: calculating the total number of sampling points relative to a certain sampling point m. i The centroid height increment, and all sampling points relative to a certain sampling point m. iThe centroid height increments are arranged in the order of sampling points to obtain sampling point m. i centroid height sequence H i H i =(h i,i h i,i+1 h i,N h i,1 ,...h i,i+1 ) T The sequence contains N elements, corresponding to N sampling points relative to sampling point m. i The centroid height increment; obtaining the centroid height increment matrix specifically includes: the centroid height increment sequence H corresponding to all sampling points. i Arranged in order of sampling points, the centroid height increment matrix L(M) is obtained: L(M) = (H1, H2, ..., H...). N-1 H N ).
[0011] Furthermore, obtaining the centroid height increment feature matrix also includes the following steps: [The text abruptly ends here, so the translation stops.] i,j Normalization is performed to obtain the normalized centroid height increment. ||h i,j || represents the modulus of the centroid height increment; the normalized centroid height increment sequence. The normalized centroid height increment sequence H i Add positive integer coefficients d, where d (1 < d < N); divide the normalized centroid height increment sequence Hi into S disjoint subsequences [1, d], [1+d, 2d], ..., where S = [N / d]; calculate the average centroid height increment c of each subsequence using the following formula. i,t :
[0012]
[0013] Where t = 1, 2, ..., S; the S mean data are arranged in order to obtain the sampling points m. i The smoothed feature sequence C i :C i =(c i,1 c i,2 c i,S-1 c i,s ) T ; the centroid height increment feature sequence C after smoothing all sampling points i Arranged in order of sampling points, the smoothed centroid height increment feature matrix F(M) is obtained: F(M) = (C1, C2, ..., C N-1 C N).
[0014] Furthermore, the centroid height increment feature matrices of the template image and the target image are compared using the DTW algorithm to obtain the first feature distance. Specifically, this includes: Let the set of contour sampling points of the target image be M, M = {m1, m2, ..., m}. N Let Z be the set of sampling points for the template image contour, Z = {z1, z2, ..., z}. N The centroid height increment feature matrix of the template image obtained after normalization and smoothing is denoted as F(Z): Where 1 < r ≤ N; Let be the r-th feature vector of the template image; the centroid height increment feature matrix of the target image obtained after normalization and smoothing is denoted as F(M): Where 1 < e < N; Let e be the e-th feature vector of the target image; the first feature distance is defined according to the DTW algorithm as:
[0015]
[0016] in, The problem can be transformed into solving the subsequence problem of F(M) and F(Z) using the following recurrence relation:
[0017]
[0018] The first feature 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)).
[0019] Furthermore, by comparing the centroid height increment feature matrices of the template image and the flipped image using the DTW algorithm, the second feature distance is obtained. Specifically, this includes: flipping the target image to obtain the flipped image; and assuming the set of contour sampling points of the flipped image is M. x The centroid height increment feature matrix of the target image is denoted as F(M). x ); Flip the image contour sampling point set M x The second feature distance between the template image contour sampling point set Z and is: Dis(M) x Z) = d DTW (F(M x The minimum feature distance between the first feature distance and the second feature distance is obtained through the minimum value function, specifically by calculating the minimum feature distance using the following formula: D(M, Z) = min(Dis(M, Z), Dis(M)). x ,Z)).
[0020] Furthermore, the introduction of shape complexity into the minimum feature distance calculation specifically includes defining shape complexity as: Where std represents the standard deviation; after introducing shape complexity, the similarity distance is calculated using the following formula:
[0021]
[0022] Furthermore, the contour target recognition method based on the combination of centroid height increment and DTW also includes the following steps: establishing a contour template library, which includes multiple template images; matching the target image with the multiple template images in the contour template library; and outputting the template image that matches the target image as the recognition result.
[0023] Furthermore, 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.
[0024] Compared to existing technologies, this invention employs a contour target recognition method combining centroid height increment and DTW (Data Transmission Method) for target recognition. When comparing the distance values of the centroid height increment matrix between the target image and the template image, the DTW algorithm only retains the cumulative distance of the first column, eliminating the need to retain all data. This reduces the algorithm's time complexity, thus improving recognition processing speed and making it suitable for real-time target recognition. Furthermore, this invention flips the target image and uses the DTW algorithm for secondary recognition of the flipped image and the template image, thereby improving the accuracy of target recognition and avoiding recognition errors caused by image flipping. Because the DTW algorithm has a fast recognition processing speed, the overall computation speed remains high despite the secondary recognition, achieving a good balance between accuracy and computational speed. This invention also introduces shape complexity to further improve contour matching. Higher shape complexity results in lower sensitivity to local contour deformation, making the recognition results more reliable and thus improving the noise resistance of target recognition. Attached Figure Description
[0025] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent upon reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, with the same or corresponding reference numerals denoteing the same or corresponding parts, wherein:
[0026] Figure 1 The schematic diagram illustrates a flowchart of a contour target recognition method based on a combination of centroid height increment and DTW provided in an optional embodiment of the present invention.
[0027] Figure 2The flowchart illustrating the comparison between the target image and the template image in this invention is shown schematically.
[0028] Figure 3 The schematic diagram illustrates a portion of the process after introducing shape complexity in this invention.
[0029] Figure 4 The diagram illustrates the process of extracting the outer contour of an image and extracting multiple sampling points on the outer contour to generate a contour sampling point set according to the present invention.
[0030] Figure 5 The diagram schematically illustrates feature maps of different sampling points of different shapes, which are based on the smoothed feature sequence C of the corresponding sampling points. i Drawing formation;
[0031] Figure 6 A schematic diagram of the target recognition results is shown. Detailed Implementation
[0032] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Unless otherwise specified, the techniques used in the embodiments are conventional means well known to those skilled in the art.
[0033] It should be noted that, unless otherwise stated, the technical or scientific terms used in this invention should be understood in their ordinary sense by those skilled in the art. In this document, relational terms such as “first” and “second” are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms “connected,” “linked,” etc., should be interpreted broadly, for example, referring to a fixed connection, a detachable connection, or an integral connection; a mechanical connection or an electrical connection; a direct connection or an indirect connection via an intermediate medium. The terms “comprising,” “including,” or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase “comprising…” does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0034] This invention provides a contour target recognition method based on a combination of centroid height increment and DTW (Dynamic Depth-Warping), comprising the following steps: obtaining the centroid height increment feature matrices of a template image and a target image; comparing the centroid height increment feature matrices of the template image and the target image using the DTW algorithm to obtain a first feature distance; flipping the target image and obtaining the centroid height increment feature matrix of the flipped image; comparing the centroid height increment feature matrices of the template image and the flipped image using the DTW algorithm to obtain a second feature distance; finding the minimum feature distance between the first feature distance and the second feature distance using a minimum value function; introducing shape complexity into the minimum feature distance to obtain a similarity distance; and outputting the recognition result based on the similarity distance.
[0035] This invention employs the DTW algorithm for target recognition. When calculating the centroid height increment matrix, the DTW algorithm only retains the cumulative distance of the previous column, eliminating the need to retain all data. This reduces the algorithm's time complexity, thus improving recognition speed and making it suitable for real-time target recognition. Furthermore, this invention 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 errors caused by image flipping. Because the DTW algorithm has a fast processing speed, the overall computation speed remains high despite the secondary recognition, achieving a good balance between accuracy and computational speed. This invention also introduces shape complexity to further improve contour matching. Higher shape complexity results in lower sensitivity to local contour deformation, making the recognition results more reliable and thus improving the noise resistance of target recognition.
[0036] Optionally, obtaining the centroid height increment feature matrix includes the following steps: preprocessing the image; extracting the outer contour of the image; extracting multiple sampling points on the outer contour to generate a contour sampling point set; calculating the contour centroid of the contour sampling point set; calculating the centroid height; calculating the centroid height increment; obtaining the centroid height increment sequence; and obtaining the centroid height increment matrix.
[0037] Optionally, image preprocessing specifically includes the following steps: converting the image from a three-channel image to a single-channel image; performing thresholding noise reduction on the single-channel image; and extracting the outer contour of the image by the following steps: using the Canny differential operator to extract the edges of the image; using image morphology operations to dilate small edges and fill holes to form a complete outer contour; and using the Canny differential operator again to accurately extract the outer contour.
[0038] Optionally, extracting multiple sampling points on the outer contour to generate a contour sampling point set specifically includes: extracting N sampling points at equal intervals on the outer contour to generate a contour sampling point set M; where M = {m j}={m i m2, ..., m N}
[0039] Optionally, calculating the centroid of the contour sampling point set specifically includes: calculating the centroid Q(x0, y0) of the contour sampling point set using the following formula:
[0040] Optionally, calculating the centroid height specifically includes: defining any sampling point m j (x j y j The Euclidean distance between any sampling point m and the centroid Q(x0, y0) is given by the distance between the sampling point m and the centroid Q(x0, y0). j The centroid height, j = (1, 2, ... N); calculate the height of any sampling point m using the following formula. j (x j y j The centroid height g between the centroid of the profile Q(x0, y0) and the centroid of the profile Q(x0, y0) j :
[0041] Optionally, calculating the centroid height increment specifically includes: defining any sampling point m j The height of the center of mass g j With a certain sampling point m i The height of the center of mass g i The difference between them is the difference between any sampling point m. j Relative to a certain sampling point m i The increment of the centroid height h i,j , i = (1, 2, ... N); obtaining the centroid height increment sequence specifically includes: calculating the total number of sampling points relative to a certain sampling point m. i The centroid height increment, and all sampling points relative to a certain sampling point m. i The centroid height increments are arranged in the order of sampling points to obtain sampling point m. i centroid height sequence H i :Hi=(h i,i h i,i+1 h i,N h i,1 ,...h i,i+1 ) T The sequence contains N elements, corresponding to N sampling points relative to sampling point m. i The increase in the height of the center of mass.
[0042] Optionally, obtaining the centroid height increment matrix specifically includes: calculating the centroid height increment sequence H corresponding to all sampling points. i Arranged in order of sampling points, the centroid height increment matrix L(M) is obtained: L(M) = (H1, H2, ..., H...).N-1 H N ).
[0043] Optionally, obtaining the centroid height increment feature matrix further includes the following steps: processing the centroid height increment h i,j Normalization is performed to obtain the normalized centroid height increment. ||h i,j || represents the modulus of the centroid height increment; the normalized centroid height increment sequence. Thus, the centroid height increment after normalization It has scaling invariance.
[0044] The normalized centroid height increment sequence H i Add positive integer coefficients d, where d (1 < d < N); divide the normalized centroid height increment sequence Hi into S disjoint subsequences [1, d], [1+d, 2d], ..., where S = [N / d]; calculate the average centroid height increment c of each subsequence using the following formula. i,t :
[0045]
[0046] Where t = 1, 2, ... S; f = (t-1) × d, f is the centroid height increment of d sequences, the smoothed centroid height increment is the average of the centroid height increments of d sequences, and adding d smooths and reduces the dimension of the image feature matrix.
[0047] Arrange the S mean data points in order to obtain the sampling points m. i The smoothed feature sequence C i :C i =(c i,1 c i,2 c i,S-1 c i,S ) T ; the centroid height increment feature sequence C after smoothing all sampling points i Arranged in order of sampling points, the smoothed centroid height increment feature matrix F(M) is obtained: F(M) = (C1, C2, ..., C N-1 C N After smoothing, the descriptor is less sensitive to local contour deformation caused by noise, the feature dimension is reduced, and the calculation is simpler, achieving a good trade-off between accuracy, noise resistance, and simplicity. Smoothing not only improves the robustness of the descriptor to contour deformation and noise interference but also reduces the dimensionality of the feature vector, facilitating subsequent matching.
[0048] Optionally, the first feature distance is obtained by comparing the centroid height increment feature matrices of the template image and the target image using the DTW algorithm. Specifically, this includes: Let the set of contour sampling points of the target image be M, M = {m1, m2, ..., m}. N Let Z be the set of sampling points for the template image contour, Z = {z1, z2, ..., z}. N The centroid height increment feature matrix of the template image obtained after normalization and smoothing is denoted as F(Z): Where 1 < r ≤ N; Let be the r-th feature vector of the template image; the centroid height increment feature matrix of the target image obtained after normalization and smoothing is denoted as F(M): Where 1 < e < N; Let e be the e-th feature vector of the target image; the first feature distance is defined according to the DTW algorithm as:
[0049]
[0050] in, The problem can be transformed into solving the subsequence problem of F(M) and F(Z) using the following recurrence relation:
[0051]
[0052] The first feature 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)). Thus, the DTW algorithm is used to compare the target image and the template image. Based on the magnitude of the first feature distance, it is determined whether the target image and the template image match. The smaller the first feature distance, the better the target image matches the template image.
[0053] Where, C1 to C in F(M) N for When comparing a two-dimensional matrix using the DTW algorithm, it is necessary to compare the point features in the matrix. Therefore, F(M) = (C1, C2, ..., C N -1, C N ) represents
[0054] Optionally, the second feature distance is obtained by comparing the centroid height increment feature matrices of the template image and the flipped image using the DTW algorithm. Specifically, this includes: flipping the target image to obtain the flipped image; and letting the set of contour sampling points of the flipped image be M. x The centroid height increment feature matrix of the target image is denoted as F(M). x ); Flip the image contour sampling point set M xThe second feature distance between the template image contour sampling point set Z and is: Dis(M) x Z) = d DTW (F(M x ), F(Z)). In this way, the DTW algorithm is used to compare the flipped image of the target image with the template image. Based on the magnitude of the second feature distance, it is determined whether the flipped image of the target image and the template image match. The smaller the second feature distance, the better the flipped image of the target image matches the template image.
[0055] Optionally, finding the minimum feature distance between the first feature distance and the second feature distance using the minimum value function specifically includes calculating the minimum feature distance using the following formula:
[0056] D(M,Z)=min(Dis(M,Z),Dis(M x ,Z)).
[0057] In this way, the minimum feature distance is used to determine whether the target image matches the template image; the smaller the minimum feature distance, the better the match. Performing a secondary matching between the flipped image of the target image and the template image can further improve the matching accuracy.
[0058] Optionally, the flipped image of the target to be tested can be obtained by flipping the target image.
[0059] Optionally, incorporating shape complexity into the minimum feature distance calculation to obtain the similarity distance specifically includes defining shape complexity as: Where std represents the standard deviation; after introducing shape complexity, the similarity distance is calculated using the following formula:
[0060]
[0061] Introducing shape complexity can improve the noise resistance of contour target recognition methods and further enhance matching performance. With increased shape complexity, the sensitivity to local contour deformation decreases, leading to more reliable recognition results.
[0062] Optionally, the contour target recognition method based on the combination of centroid height increment and DTW further includes the following steps: establishing a contour template library, which includes multiple template images; matching the target image with the multiple template images in the contour template library, and outputting the template image that matches the target image as the recognition result. Here, the template image is a defined object image, and the target image is an undefined object image. Through the contour target recognition method of this application, the object type of the target image can be identified.
[0063] Optionally, the contour template library includes the original image of the template image and a 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 this application has translation, rotation, and scaling invariance.
[0064] The following is combined Figures 1 to 6 The following describes in detail the optional specific embodiments of this application.
[0065] like Figure 1 As shown, the contour target recognition method based on the combination of centroid height increment and DTW in the optional specific embodiments provided in this application includes the following steps:
[0066] (1) Image preprocessing and contour extraction: The target image and several template images are preprocessed and their respective outer contours are extracted using a contour extraction algorithm. The target image is an image of an uncertain object, and the template images are images of a definite object.
[0067] (2) Uniform sampling and centroid extraction of 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. Using the contour centroid as a reference point, establish a centroid height increment descriptor based on the height relationship of other points relative to this point: calculate the distance between each of the selected sampling points and the centroid, as well as the centroid height increment.
[0068] (3) Normalize and smooth the centroid height increment feature: reduce the dimension of the centroid height increment feature obtained in step (2) and make it translation and rotation invariant.
[0069] (4) Use the DTW algorithm to calculate the feature distance between the two contours: Apply the processed centroid height increment feature obtained in step (3) to calculate the matching cost and then calculate the feature distance between the contours.
[0070] (5) The target image is flipped and compared with the template library image for the second time. The minimum similarity distance is obtained by applying the minimum value function to obtain the initial recognition result. Then, the target image is recognized again by combining shape complexity analysis to obtain the final recognition result.
[0071] Step (1) includes the following steps (1.1) to (1.5):
[0072] (1.1) The image is converted from a three-channel image to a single-channel image;
[0073] (1.2) Thresholding noise reduction is performed on the image;
[0074] (1.3) The Canny differential operator is used to extract the edges of the image;
[0075] (1.4) Use image morphology operations to expand the small edges and fill the holes to form a complete outer contour;
[0076] (1.5) The Canny differential operator is used again to accurately extract the outer contour.
[0077] Step (2) includes the following steps (2.1) to (2.2):
[0078] (2.1) Extract N effective feature points on the outer contour of the image;
[0079] (2.2) Calculate the centroid of the contour according to the algorithm;
[0080] (2.3) Calculate the distance between the sampling point and the centroid, i.e., the centroid height value;
[0081] (2.4) Obtaining the centroid height increment sequence;
[0082] (2.5) Obtaining the centroid height increment matrix;
[0083] like Figure 4 (a)(b), in step (2.1), the extraction of contour feature points involves equally spaced sampling, selecting a certain number of contour points. This includes the following steps: extracting a complete set of contour points from the image contour; selecting N contour points; dividing the total number of contour points m by the required number of points N to obtain the contour sampling distance m / N; and selecting the starting point of the contour points can be random. Therefore, the larger the number of sampling points N, the more accurate the shape description.
[0084] like Figure 4 (c) Step (2.2) uses the point set of the contour part obtained from step (2.1), denoted as M = {m i}={m1,m2,...,m N}, where N is the number of sampling points, m i Let m be the i-th sampling point of the contour. i (x i y i The formula for calculating the centroid Q(x0, y0) of the profile is as follows:
[0085]
[0086] Step (2.3) involves calculating the centroid height increment of the contour. The most crucial step is determining the distance between the sampling point and the centroid, i.e., the centroid height value. This value characterizes the position of the sampling point on the contour. For sampling point m... i (x i y i Define the height of the centroid g. iLet Q(x0, y0) be the Euclidean distance between this point and the centroid Q(x0, y0), i.e.:
[0087]
[0088] like Figure 5 As shown, feature maps of a marked contour and different sampling points A, B, and C of the contour are presented. These feature maps are based on the smoothed feature sequence C of the corresponding sampling points. i The drawing process can confirm the differences between different sampling points of the same contour.
[0089] Step (2.4) involves obtaining the centroid height increment sequence by placing all sampling points relative to point m. i The centroid height increments are arranged in sequence according to the contour points to obtain sampling points m. i The centroid height increment sequence H i ,Right now:
[0090] H i =(h i,i h i,i+1 ,..h i,N h i,1 ,..h i,i-1 ) T ;
[0091] like Figure 4 Step (2.5) involves obtaining the centroid height increment matrix by taking the centroid height increment sequence H corresponding to each point on the shape contour M. i Arranging the contour points in order, we obtain a matrix of size N′N:
[0092] L(M) = (H1, H2, ..., H N-1 H N );
[0093] In the formula, L(M) represents the centroid height increment matrix of the contour, and the i-th column of the matrix represents the sampling point m on the contour M. i The centroid height increment descriptor. This descriptor describes the relative height relationships between points on the contour and does not change with the rotation and translation of the contour.
[0094] Step (3) involves normalizing and smoothing the centroid height increment feature, which includes the following steps:
[0095] To make the descriptor scale invariant, we normalize each row of the matrix:
[0096]
[0097] In the formula ||h t,j || represents the modulus of the centroid height increment data. This formula defines the sampling point m.i While this method effectively describes the contour information relative to the centroid height increment of all sampling points of the contour, it is overly sensitive to local contour deformation caused by noise. Furthermore, the feature dimension is too high and the computation is computationally complex. Therefore, a smoothing strategy is adopted to achieve a good trade-off between the accuracy, noise resistance, and simplicity of the descriptor. The specific process is as follows:
[0098] For m i The increment of the centroid height of a point can be expressed as:
[0099]
[0100] The sequence contains N elements, corresponding to the centroid height increments of N sampling points relative to that point. Adding a positive integer coefficient d (1 < d < N), the sequence is divided into S disjoint subsequences [1, d], [1+d, 2d], ..., where S = [N / d]. Calculate the average centroid height increment for each subsequence:
[0101]
[0102] In the formula, t = 1, 2, ..., S. Arranging the S mean data in order, we obtain point m. i The smoothed feature sequence C i That is: C i =(c i,1 c i,2 c i,S-1 c i,s ) T ;
[0103] After smoothing, not only is the robustness of the descriptor to contour deformation and noise interference improved, but the dimensionality of the feature vector is also reduced, facilitating subsequent matching. Arranging all the smoothed descriptors in order, we obtain the centroid height increment feature matrix F(M) of the contour M:
[0104] F(M) = (C1, C2, ..., C N-1 C N );
[0105] Step (4) Calculating the feature distance between two contours using the DTW algorithm includes the following steps:
[0106] like Figure 2 and Figure 3 As shown, after obtaining the feature descriptor of the shape 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 to match the obtained shape features.
[0107] The DTW algorithm employs dynamic programming, transforming the problem of determining the similarity between the target contour and the template contour into solving 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. Let the target contour point set M = {m1, m2, ..., m} N} and the template image contour point set Z = {z1, z2, ..., z} N The centroid height increment features are extracted from the target contour to obtain the centroid height increment matrices F(M) and F(Z). Assume the feature matrix of the target contour...
[0108] Where 1 < e < N; is the feature matrix of the template image. Where, 1 < r ≤ N; where and Let 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 the two shapes is defined according to the DTW algorithm as:
[0109]
[0110] In the formula
[0111] The DTW algorithm employs dynamic programming, using the recurrence relation below to transform the above problem into solving a problem of subsequences F(M) and F(Z):
[0112]
[0113] That is, the similarity distance between contours M and Z is:
[0114] Dis(M, Z) = d DTW (F(M), F(Z));
[0115] Step (5) specifically includes the following steps:
[0116] (5.1) Flip the target image and the template image for a second matching, and use the minimum value function to find the minimum distance between the two contours.
[0117] like Figure 2 As shown, in step (5.1), the target to be identified often flips during image recognition, increasing the probability of mismatch. Therefore, the contour M of the image to be identified is flipped to obtain M0. x Shape M x Matching shape Z with the distance between them yields the following:
[0118] Dis(M x Z) = d DTW (F(M x), F(Z))
[0119] (5.2) The final recognition result is obtained by combining shape complexity analysis.
[0120] like Figure 6 As shown, in step (5.2), the higher the complexity of the shape, the lower the sensitivity to local deformation of the contour, and the more reliable the recognition result. Therefore, shape complexity is introduced to further improve the contour matching effect. The complexity of the shape contour is defined as:
[0121]
[0122] In the formula, std represents the standard deviation. By introducing shape complexity, the similarity distance Q(M, Z) between the two shapes is finally obtained:
[0123]
[0124] In the formula, Q(M) and Q(Z) are the complexities of shapes M and Z, respectively.
[0125] To address the problem of target recognition based on contour features, this application proposes a contour target recognition method combining centroid height increment and Direct Path Weaving (DTW). This method integrates centroid height increment feature descriptors with the DTW similarity measurement algorithm. First, sampling points are uniformly extracted from the target contour, and centroid height increment features are extracted from the contour points of both the target and template images. Then, the DTW algorithm is used to find regular paths to measure the similarity of the feature matrices of the target and template images. Finally, shape complexity analysis of the contour is combined to obtain the final recognition result. This method ensures a recognition rate superior to most common traditional target recognition algorithms while improving the real-time performance of target recognition.
[0126] The preferred embodiment of this application provides a contour target recognition method based on centroid height increment and DTW, which includes the following steps: establishing a contour template library of multiple types of target images and template images; performing image preprocessing and outer contour extraction on the template images and target images respectively, and generating contour point sets; extracting centroid height increment features of the contours of the template images and target images respectively, and performing normalization and smoothing processing; calculating the distance of centroid height increment features between the template images and target images using the DTW algorithm; flipping the target image and performing a secondary comparison with the template library images, and applying the minimum value function to obtain the minimum similarity distance to obtain the initial recognition result; and then performing the target image recognition again in conjunction with shape complexity analysis to obtain the final recognition result.
[0127] Preferably, the contour template library specifically includes geometric transformation features of the image and complete image features.
[0128] Preferably, image preprocessing and outer contour extraction specifically include the following steps: converting the image from a three-channel image to a single-channel image; performing thresholding noise reduction on the image; extracting the edges of the image using the Canny differential operator; using image morphological operations to dilate small edges and fill holes to form a complete outer contour; and then using the Canny differential operator again to accurately extract the outer contour.
[0129] Preferably, the extraction of centroid height increment features of the contour, followed by normalization and smoothing, specifically includes the following steps: determining the contour centroid; extracting centroid height increment features of the target image using a feature extraction algorithm: calculating the centroid height of N points, then calculating the centroid height increment of N points, applying the contour order to arrange the centroid height increments of arbitrary sampling points to obtain a centroid height increment sequence, and finally obtaining a centroid height increment matrix composed of the centroid height increment sequences of N points; normalizing the centroid height increment features of the contour sampling points; and smoothing the centroid height increment features of the contour sampling points.
[0130] Preferably, calculating the centroid height increment feature distance between the template image and the target image using the DTW algorithm specifically includes the following steps: quantifying the similarity of the centroid height increment features between the sampling points of the target contour and the template contour using the DTW algorithm. The DTW algorithm transforms the overall problem of calculating the similarity between two contours into a sub-problem of calculating the similarity between contour points.
[0131] The preferred embodiment of this invention provides a contour target recognition method based on centroid height increment and DTW (Dynamic Time-Digital Wave) technology, belonging to the field of machine vision and target detection technology. It solves the problem of low recognition processing speed and the challenge of balancing recognition rate and accuracy in existing technologies. The method involves preprocessing and extracting contours from the template image and the image to be recognized. The contours are uniformly sampled and their centroids are calculated. Using the centroid as a reference point, a centroid height increment descriptor is constructed based on the height relationship of other sampled points relative to this point. The centroid height increment feature is then normalized and smoothed. The DTW algorithm is used to obtain the feature distance between two contours. Then, the target image is flipped for secondary recognition. A minimum value function is defined to obtain the shortest similarity distance between the two recognitions. Finally, the complexity analysis of the contour features is combined to select the final recognition result. This invention combines the centroid height increment contour description method with the DTW algorithm, ensuring good recognition rate while improving the real-time performance of target recognition.
[0132] The beneficial technical effects of this invention include at least the following: Given the low accuracy and high complexity of traditional contour target recognition algorithms, this invention considers combining centroid height increment feature descriptors with spatial relationships with the DTW algorithm, thereby reducing algorithm complexity by smoothly reducing the feature dimension during the recognition process. Furthermore, in cases of low target recognition accuracy, this invention considers flipping the target image for secondary recognition and combining shape complexity to improve the accuracy and robustness of target shape recognition.
[0133] Experimental results show that the retrieval rate of this application can reach over 90%, which is significantly higher than existing contour recognition algorithms. Furthermore, the overall time complexity of this application is O(N^2). 2 )+O(N 2 This value is significantly lower than the time complexity O(N) of existing contour recognition algorithms. 2 )+O(N 3 The technical solution provided in this application can effectively improve the real-time performance of target recognition while ensuring a good retrieval rate, and it strikes a good balance between efficiency and accuracy, resulting in better overall performance.
[0134] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A contour target recognition method based on a combination of centroid height increment and DTW (Dynamic Time Warping), characterized in that, Includes the following steps: Calculate the centroid height increment feature matrix of the template image and the target image; The first feature distance is obtained by comparing the centroid height increment feature matrices of the template image and the target image using the DTW algorithm. After flipping the target image, obtain the centroid height increment feature matrix of the flipped image; The second feature distance is obtained by comparing the centroid height increment feature matrices of the template image and the flipped image using the DTW algorithm. The minimum feature distance between the first feature distance and the second feature distance is obtained by using a minimum value function; Shape complexity is introduced into the minimum feature distance to calculate the similarity distance, and the recognition result is output based on the similarity distance; The steps to obtain the centroid height increment feature matrix are as follows: Preprocess the image; Extract the outer contour of the image; Multiple sampling points are extracted from the outer contour to generate a contour sampling point set; Calculate the centroid of the contour sampling point set; Calculate the height of the centroid; Calculate the centroid height increment; Find the centroid height increment sequence; Calculate the centroid height increment matrix; The image preprocessing specifically includes the following steps: converting the image from a three-channel image to a single-channel image; and performing thresholding noise reduction on the single-channel image. The extraction of the outer contour of the image includes the following steps: using the Canny differential operator to extract the edges of the image; using image morphology operations to dilate small edges and fill holes to form a complete outer contour; and using the Canny differential operator again to accurately extract the outer contour. The first feature distance is obtained by comparing the centroid height increment feature matrices of the template image and the target image using the DTW algorithm, specifically including: Let the set of contour sampling points of the target image be , ; Let the set of sampling points for the template image contour be... , ; The centroid height increment feature matrix of the template image obtained after normalization and smoothing is denoted as... : ; in, ; For the template image of the first One feature vector; The centroid height increment feature matrix of the target image obtained after normalization and smoothing is denoted as... : ; in, ; For the target image One feature vector; The first feature distance is defined according to the DTW algorithm as: ; in, ; Transform into a pair using the following recursive formula and Solving the subsequence problem: ; target image contour sampling point set and template image contour sampling point set The first feature distance between them is: ; The second feature distance is obtained by comparing the centroid height increment feature matrices of the template image and the flipped image using the DTW algorithm, specifically including: Flip the target image to obtain the flipped image; Let the set of sampling points for the contour of the flipped image be... ; The centroid height increment feature matrix of the target image is denoted as ; Flip image contour sampling point set and template image contour sampling point set The second feature distance between them is: ; Finding the minimum feature distance between the first and second feature distances using the minimum value function specifically involves calculating the minimum feature distance using the following formula: 。 2. The contour target recognition method based on centroid height increment and DTW as described in claim 1, characterized in that, Extracting multiple sampling points on the outer contour to generate a contour sampling point set specifically includes: extracting points at equal intervals on the outer contour. A set of contour sampling points is generated from each sampling point. ;in, ; Calculating the centroid of the contour sampling point set specifically involves using the following formula: : ; Calculating the centroid height specifically includes: defining any sampling point With the centroid of the outline The Euclidean distance between any sampling point The height of the center of mass, The following formula is used to calculate any sampling point. With the centroid of the outline The height of the center of mass between : ; Calculating the centroid height increment specifically includes: defining any sampling point center of mass height With a certain sampling point center of mass height The difference between them is the difference between any sampling point. Relative to a certain sampling point Increment of centroid height , ; Calculating the centroid height increment sequence specifically includes: calculating all sampling points relative to a given sampling point. The centroid height increment, and all sampling points relative to a certain sampling point. The centroid height increments are arranged in the order of the sampling points to obtain the sampling points. centroid height sequence : The sequence includes Each element corresponds to Each sampling point relative to the sampling point The increase in the height of the center of mass; Calculating the centroid height increment matrix specifically involves: the centroid height increment sequence corresponding to all sampling points. Arrange the sampling points in order to obtain the centroid height increment matrix. : 。 3. The contour target recognition method based on centroid height increment and DTW according to claim 2, characterized in that, Obtaining the centroid height increment feature matrix also includes the following steps: Increment of centroid height Normalization is performed to obtain the normalized centroid height increment. : ; The modulus representing the increment of the centroid height; normalized centroid height increment sequence ; normalized centroid height increment sequence Add positive integer coefficients , ; The normalized centroid height increment sequence Divided into S Disjoint subsequences , …,in, ; The average centroid height increment of each subsequence is calculated using the following formula. : ; in, ; Bundle The mean data are arranged in an ordered manner to obtain the sampling points. Feature sequences after smoothing : ; Centroid height increment feature sequence after smoothing all sampling points Arranged in order of sampling points, the smoothed centroid height increment feature matrix is obtained. : 。 4. The contour target recognition method based on centroid height increment and DTW according to claim 1, characterized in that, Introducing shape complexity into the minimum feature distance calculation to obtain the similarity distance specifically includes: Shape complexity is defined as: ; in, Indicates standard deviation; After introducing shape complexity, the similarity distance is calculated using the following formula: 。 5. The contour target recognition method based on the combination of centroid height increment and DTW according to any one of claims 1 to 4, characterized in that, The contour target recognition method based on the combination of centroid height increment and DTW also includes the following steps: Establish a contour template library, which includes multiple template images; The target image is matched with multiple template images in the contour template library, and the template image that matches the target image is output as the recognition result.
6. The contour target recognition method based on the combination of centroid height increment and DTW according to claim 5, characterized in that, 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.