A machine vision contour sharp corner inflection point recognition method and system

A series of image processing steps are carried out by the image processing of industrial cameras, including the calculation of the weighted coefficient of the cycling contour processing the peaceful sliding window, and identifying the sharp corner turning point of the product pattern. The problem of sensitivity of noise achieves high -efficiency and accurate sharp corner inflection points.

CN119048512BActive Publication Date: 2025-01-28SHENZHEN RUIDA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411536046.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-28
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

The existing contour sharp corner inflection point recognition methods have high computational complexity, insufficient identification accuracy, and are sensitive to noise, making it difficult to meet the needs of industrial processing.

Method used

By obtaining the outer contour pixel coordinates of the product pattern, the outer contouring pixel coordinate set is established, and the weighted coefficient calculation of the weighted coefficient, the one -dimensional smooth treatment, the relative angle amplitude calculation, the inflection point selection and the smooth coefficient filtering at the smooth outline Determine the sharp corner turning point.

Benefits of technology

Improve the accuracy and recognition efficiency of the sharp -cut inflection point recognition, reduce the sensitivity to noise, and meet the actual needs of industrial processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119048512B_ABST
    Figure CN119048512B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for identifying sharp corner inflection points of machine vision contours, and the method comprises: obtaining the coordinates of the outer contour pixel points of a product pattern, establishing a set of outer contour pixel point coordinates; performing cyclic contour processing on the set of outer contour pixel point coordinates; calculating a smooth sliding window weighted coefficient array A, and performing one-dimensional smoothing processing on the coordinate points in the set of outer contour pixel point coordinates; calculating the relative angle amplitude of each coordinate point, and establishing an ordered set C of relative angle amplitudes; selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point, and establishing an inflection point set R; removing inflection points from the set of inflection points R based on a rounding coefficient; filtering similar inflection points with lower angle amplitudes in the set of inflection points R after the inflection points are removed by a covering strategy corresponding to the inflection points of the local maximum angle amplitude; and determining the remaining inflection points in the set of inflection points R as sharp corner inflection points. The present invention improves the accuracy and efficiency of sharp corner inflection point recognition by controlling the sharp angle amplitude and the rounding rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and more specifically, to a method and system for identifying sharp corner inflection points of machine vision contours. Background Art

[0002] In some industrial processing scenarios, it is necessary to perform processing such as cutting of sharp corners on the patterns to be processed (clothes, fabrics, etc.) captured by industrial cameras, while retaining other smooth transition points to ensure the accuracy and integrity of the cutting. Therefore, it is necessary to identify all sharp corners before machine cutting and other operations.

[0003] Accurate identification of contour sharp corners is the key to achieving efficient and precise cutting. However, existing contour sharp corners identification methods often have problems such as high computational complexity, insufficient recognition accuracy, and sensitivity to noise, which makes it difficult to meet the actual needs of industrial processing.

[0004] Therefore, the prior art has defects and is in urgent need of improvement. Summary of the invention

[0005] In view of the above problems, the purpose of the present invention is to provide a method and system for identifying sharp corner inflection points of machine vision contours. By controlling the sharp angle amplitude and the rounding rate, the sharp corner inflection points of images input by industrial cameras are identified, thereby improving the accuracy and efficiency of sharp corner inflection point identification.

[0006] A first aspect of the present invention provides a method for identifying sharp corner inflection points of a machine vision contour, comprising:

[0007] Obtaining the coordinates of the outer contour pixel points of the product pattern and establishing an outer contour pixel point coordinate set; the outer contour pixel point coordinates of the product pattern include the outer contour pixel point horizontal coordinate and the vertical coordinate; the outer contour pixel point coordinate set includes the contour horizontal coordinate set X and the contour vertical coordinate set Y;

[0008] Performing circular contour processing on the outer contour pixel point coordinate set;

[0009] Calculate the smooth sliding window weight coefficient array A;

[0010] Performing one-dimensional smoothing processing on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weighted coefficient array A;

[0011] Calculate the relative angle amplitude of each coordinate point after one-dimensional smoothing, and establish an ordered set C of relative angle amplitudes;

[0012] Selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point to establish an inflection point set R;

[0013] Eliminate inflection points from the inflection point set R based on a smoothness coefficient;

[0014] The inflection points are filtered by the covering strategy of the inflection points corresponding to the local maximum angle amplitude, and the similar inflection points with lower angle amplitudes in the inflection point set R are eliminated;

[0015] The remaining inflection points in the inflection point set R are determined as sharp-angle inflection points.

[0016] In this solution, the step of obtaining the coordinates of the outer contour pixel points of the product pattern and establishing a set of outer contour pixel point coordinates includes:

[0017] Get the image data to be processed I 0 ;

[0018] The image data to be processed I 0 Perform grayscale processing and binarization operations to obtain preprocessed image data I 1 ;

[0019] The preprocessed image data I 1 Perform the outer contour filling operation to obtain the filled image data I 2 ;

[0020] The filling image data I 2 The horizontal and vertical coordinates of all the outer contour pixel points in the ordinate are added to the contour horizontal coordinate set X and the contour vertical coordinate set Y respectively according to the arrangement order of the outer contour to determine the coordinate set of the outer contour pixel points.

[0021] In this solution, the cyclic contour processing of the outer contour pixel point coordinate set includes:

[0022] Determine whether the first and last values ​​of the contour horizontal coordinate set X are the same;

[0023] Determine whether the first and last values ​​of the contour ordinate set Y are the same;

[0024] When the first value and the last value of the contour horizontal coordinate set X are the same, and the first value and the last value of the contour vertical coordinate set Y are also the same, then the outer contour pixel point coordinate set is determined to be a circular contour;

[0025] The last value of the contour abscissa set X and the last value of the contour ordinate set Y are deleted.

[0026] In this solution, the calculation of the smooth sliding window weighted coefficient array A includes:

[0027] Calculate the original Gaussian ordered array a according to the Gaussian standard deviation σ;

[0028] Each element a in the original Gaussian ordered array ai The calculation method is expressed as:

[0029] ;

[0030] Where e is the natural base, w is the sliding window width, σ is the Gaussian standard deviation, i=0, 1, 2…w-1;

[0031] For each element a in the original Gaussian ordered array a i Perform normalization processing to determine the smooth sliding window weight coefficient A i ;

[0032] ;

[0033] Based on the smooth sliding window weight coefficient A i Create a smooth sliding window weight coefficient array A.

[0034] In this solution, the one-dimensional smoothing process is performed on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weighted coefficient array A, including:

[0035] For the element X in the contour coordinate set X i Smoothing is performed to obtain element X j ;

[0036] ;

[0037] Among them, X n is the nth element in the contour coordinate set X, A m is the mth element in the smooth sliding window weight coefficient array A;

[0038] According to the element X j For the corresponding element X in the contour coordinate set X i Make updates;

[0039] For the element Y in the contour coordinate set Y i Smoothing is performed to obtain element Y j ;

[0040] ;

[0041] Among them, Y n is the nth element in the contour coordinate set Y, A m is the mth element in the smooth sliding window weight coefficient array A;

[0042] According to the element Y j For the corresponding element Y in the contour coordinate set Y i to update.

[0043] In this solution, the relative angle amplitude of each coordinate point after one-dimensional smoothing is calculated to establish an ordered set C of relative angle amplitudes, including:

[0044] According to the coordinate point P i (X i ,Y i ) and the relative spacing coefficient r determine the first coordinate point (X i-r ,Y i-r ) and the second coordinate point (X i+r ,Y i+r );

[0045] The coordinate point P is calculated by using the first coordinate point and the second coordinate point i The relative angle amplitude C i ;

[0046] The relative angle amplitude C i The calculation method is expressed as:

[0047] ;

[0048] Among them, arctan is the inverse trigonometric function, and o is the denominator coefficient constant;

[0049] According to the coordinate point P i The relative angle amplitude C i Establish an ordered set C of relative angle amplitudes.

[0050] In this solution, the local optimal inflection point is selected according to the relative angle amplitude of each coordinate point to establish an inflection point set R, including:

[0051] The coordinates corresponding to the local maximum and the local minimum in the ordered set C of relative angle amplitudes are determined as the inflection point coordinates;

[0052] The relative angle amplitude C i Less than the preset sharp angle relative amplitude threshold t 0 Filter the inflection point coordinates;

[0053] The inflection point set R is established based on the remaining inflection point coordinates.

[0054] In this solution, the step of removing inflection points from the inflection point set R based on the smoothness coefficient includes:

[0055] Based on the bottom amplitude coefficient k and the relative angle amplitude C i Calculate the inflection point R i The bottom amplitude f;

[0056] ;

[0057] Among them, k0 is the bottom amplitude coefficient;

[0058] The inflection point R i The initial value of the first index is set to i, the first index is continuously reduced by 1, and the relative angle amplitude C corresponding to the first index is repeatedly calculated. g , when the relative angle amplitude C corresponding to the first index g Less than C i , determine the final first index g;

[0059] The inflection point R i The initial value of the second index is set to i, the second index is continuously increased by 1, and the relative angle amplitude C corresponding to the second index is repeatedly calculated. h , when the relative angle amplitude C corresponding to the second index h Less than C i , determine the final second index h;

[0060] By the relative angle amplitude C i , bottom amplitude f, first index g and second index h to calculate the inflection point R i The smoothness coefficient k 1 ;

[0061] ;

[0062] The smoothness coefficient k 1 Less than the preset threshold t 1 The inflection point of is removed from the inflection point set R.

[0063] In this solution, the coverage strategy of the inflection point corresponding to the local maximum angle amplitude is used to filter the inflection points and remove the similar inflection points with lower angle amplitudes in the inflection point set R, including:

[0064] Calculate the inflection point R based on the first index g and the second index h i The coverage u;

[0065] ;

[0066] Among them, k 2 is the coverage factor;

[0067] Analyze according to the coverage range u to determine other inflection points with coordinate indexes within the range of iu and i+u;

[0068] The inflection point R i and the other inflection points are determined as close inflection points, and it is determined whether the relative angle amplitude corresponding to the other inflection points is smaller than that of the inflection point R i The corresponding relative angle amplitude C i ;

[0069] If yes, then remove the other inflection points;

[0070] If not, then the inflection point R i To be eliminated.

[0071] A second aspect of the present invention provides a machine vision contour sharp corner inflection point recognition system, comprising:

[0072] The first analysis module is used to obtain the coordinates of the outer contour pixel points of the product pattern and establish an outer contour pixel point coordinate set; the outer contour pixel point coordinates of the product pattern include the outer contour pixel point horizontal coordinate and the vertical coordinate; the outer contour pixel point coordinate set includes the contour horizontal coordinate set X and the contour vertical coordinate set Y; and the outer contour pixel point coordinate set is subjected to cyclic contour processing;

[0073] The second analysis module is used to calculate the smooth sliding window weight coefficient array A; perform one-dimensional smoothing processing on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weight coefficient array A; calculate the relative angle amplitude of each coordinate point after the one-dimensional smoothing processing, and establish an ordered set C of relative angle amplitudes;

[0074] A third analysis module is used to select a local optimal inflection point according to the relative angle amplitude of each coordinate point and establish an inflection point set R;

[0075] A first inflection point elimination module, configured to eliminate inflection points of the inflection point set R based on a smoothing coefficient;

[0076] The second inflection point elimination module is used to filter the similar inflection points with lower angle amplitudes in the inflection point set R after the inflection point elimination through the covering strategy of the inflection point corresponding to the local maximum angle amplitude; and determine the remaining inflection points in the inflection point set R as sharp-angle inflection points.

[0077] The third aspect of the present invention provides a computer-readable storage medium, which includes a machine vision contour sharp corner inflection point recognition method program. When the machine vision contour sharp corner inflection point recognition method program is executed by a processor, the steps of the machine vision contour sharp corner inflection point recognition method as described above are implemented.

[0078] The present invention discloses a method and system for identifying sharp corner inflection points of machine vision contours, and the method comprises: obtaining the coordinates of the outer contour pixel points of a product pattern, establishing a set of outer contour pixel point coordinates; performing cyclic contour processing on the set of outer contour pixel point coordinates; calculating a smooth sliding window weighted coefficient array A, and performing one-dimensional smoothing processing on the coordinate points in the set of outer contour pixel point coordinates; calculating the relative angle amplitude of each coordinate point, and establishing an ordered set C of relative angle amplitudes; selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point, and establishing an inflection point set R; removing inflection points from the set of inflection points R based on a rounding coefficient; filtering similar inflection points with lower angle amplitudes in the set of inflection points R after the inflection points are removed by a covering strategy corresponding to the inflection points of the local maximum angle amplitude; and determining the remaining inflection points in the set of inflection points R as sharp corner inflection points. The present invention improves the accuracy and efficiency of sharp corner inflection point recognition by controlling the sharp angle amplitude and the rounding rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] Figure 1 A flow chart of a method for identifying sharp corner inflection points of a machine vision contour provided by the present invention is shown;

[0080] Figure 2 A flow chart of a method for establishing a set of outer contour pixel point coordinates provided by the present invention is shown;

[0081] Figure 3 A flow chart showing a method for performing cyclic contour processing on a set of outer contour pixel point coordinates provided by the present invention is shown;

[0082] Figure 4 A block diagram of a machine vision contour sharp corner inflection point recognition system provided by the present invention is shown. DETAILED DESCRIPTION

[0083] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0084] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0085] Figure 1 A flow chart of a method for identifying sharp corner inflection points of a machine vision contour provided by the present invention is shown.

[0086] like Figure 1 As shown, the present invention discloses a method for identifying sharp corner inflection points of machine vision contours, comprising:

[0087] S102, obtaining the coordinates of the outer contour pixel points of the product pattern and establishing an outer contour pixel point coordinate set; the outer contour pixel point coordinates of the product pattern include the outer contour pixel point horizontal coordinates and vertical coordinates; the outer contour pixel point coordinate set includes the contour horizontal coordinate set X and the contour vertical coordinate set Y;

[0088] S104, performing circular contour processing on the outer contour pixel point coordinate set;

[0089] S106, calculating a smooth sliding window weighted coefficient array A;

[0090] S108, performing one-dimensional smoothing processing on the coordinate points in the outer contour pixel point coordinate set based on the smoothing sliding window weighted coefficient array A;

[0091] S110, calculating the relative angle amplitude of each coordinate point after one-dimensional smoothing processing, and establishing an ordered set C of relative angle amplitudes;

[0092] S112, selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point, and establishing an inflection point set R;

[0093] S114, removing inflection points from the inflection point set R based on the smoothness coefficient;

[0094] S116, filtering the inflection points by using a coverage strategy corresponding to the inflection points of the local maximum angle amplitude to remove the similar inflection points with lower angle amplitudes in the inflection point set R;

[0095] S118, determining the remaining inflection points in the inflection point set R as sharp-angle inflection points.

[0096] According to the embodiment of the present invention, by treating the processed image data I 0 Image preprocessing and contour filling obtain the outer contour pixel coordinates of the product pattern, add the outer contour pixel horizontal coordinates and vertical coordinates to the contour horizontal coordinate set X and contour vertical coordinate set Y in the order of the outer contour, and establish the outer contour pixel coordinate set. Compare the first and last values ​​of the contour horizontal coordinate set X and the first and last values ​​of the contour vertical coordinate set Y to determine whether the outer contour pixel coordinate set is a cyclic contour, and delete the last values ​​in the contour horizontal coordinate set X and contour vertical coordinate set Y in the cyclic contour. Calculate the smooth sliding window weighting coefficient A according to the Gaussian standard deviation σ set by the system i , through the smooth sliding window weight coefficient A i For each element X in the contour coordinate set X i and the element Y in the contour coordinate set Y i Smoothing is performed and the obtained element X is used j and element Y j For the corresponding element X iand element Y i Update and determine the final outer contour pixel point coordinate set. Calculate the inner coordinate point P of the outer contour pixel point coordinate set according to the relative interval coefficient r i (X i ,Y i ) corresponds to the first coordinate point (X i-r ,Y i-r ) and the second coordinate point (X i+r ,Y i+r ), through the relative angle amplitude C i The calculation method determines the coordinate point P i (X i ,Y i )'s relative angle amplitude C i , after the relative angle amplitudes of all coordinate points in the outer contour pixel point coordinate set are calculated, an ordered set C of relative angle amplitudes is established. The coordinates corresponding to the local maximum and local minimum values ​​in the ordered set C of relative angle amplitudes are determined as the inflection point coordinates, and the relative angle amplitude C is i Less than the preset sharp angle relative amplitude threshold t 0 Filter the inflection point coordinates, and establish the inflection point set R based on the remaining inflection point coordinates. Calculate the inflection point R in the inflection point set R i The bottom amplitude f, and through the inflection point R i The bottom amplitude f determines the corresponding first index g and second index h, thereby calculating the inflection point R i The smoothness coefficient k 1 , the smoothness coefficient k 1 Less than the preset threshold t 1 The inflection point is removed from the inflection point set R. Finally, the inflection point R is determined by the first index g and the second index h i The coverage range u is used to determine the inflection point R i At the inflection points in the range of iu and i+u, the inflection points are represented by other inflection points. Compare other inflection points with inflection point R i The relative angle amplitude of the inflection point is filtered out for the inflection points with smaller angle amplitude. After all the inflection points in the inflection point set R are analyzed, the remaining inflection points are determined as sharp inflection points.

[0097] Figure 2 A flow chart of the method for establishing a set of outer contour pixel point coordinates provided by the present invention is shown.

[0098] like Figure 2 As shown, according to an embodiment of the present invention, the coordinates of the outer contour pixel points of the product pattern are obtained, and a set of the outer contour pixel point coordinates is established, including:

[0099] S202, obtaining image data to be processed I 0 ;

[0100] S204, processing image data I 0 Perform grayscale processing and binarization operations to obtain preprocessed image data I 1 ;

[0101] S206, pre-processing the image data I 1 Perform the outer contour filling operation to obtain the filled image data I 2 ;

[0102] S208, fill the image data I 2 The horizontal and vertical coordinates of all the outer contour pixel points in the ordinate are added to the contour horizontal coordinate set X and the contour vertical coordinate set Y respectively according to the arrangement order of the outer contour to determine the coordinate set of the outer contour pixel points.

[0103] It should be noted that the image data to be processed taken by industrial cameras and other equipment is obtained. 0 After that, the image data to be processed is first preprocessed. The preprocessing process includes grayscale processing and binarization operation. First, the image data to be processed is grayscale processed by the grayscale processing method preset by the system (such as average method, weighted average method, etc.) to obtain grayscale image data. Then, a suitable threshold is selected to perform binarization processing on the grayscale image data, and the grayscale image data is converted into binary image data, that is, the preprocessed image data I 1 . Preprocess image data I 1 Perform the outer contour filling operation to eliminate the internal holes and obtain the filled image data I 2 .

[0104] Among them, the contour abscissa set X and the contour ordinate set Y are both ordered sets.

[0105] Figure 3 A flow chart of a method for performing cyclic contour processing on a set of outer contour pixel point coordinates provided by the present invention is shown.

[0106] like Figure 3 As shown, according to an embodiment of the present invention, a circular contour processing is performed on a set of outer contour pixel point coordinates, including:

[0107] S302, determining whether the first digit value and the last digit value of the contour horizontal coordinate set X are the same;

[0108] S304, determining whether the first digit value and the last digit value of the contour vertical coordinate set Y are the same;

[0109] S306, when the first value and the last value of the contour horizontal coordinate set X are the same, and the first value and the last value of the contour vertical coordinate set Y are also the same, then the outer contour pixel point coordinate set is determined to be a circular contour;

[0110] S308, deleting the last value of the contour horizontal coordinate set X and the last value of the contour vertical coordinate set Y.

[0111] It should be noted that when the outer contour pixel point coordinate set is a circular contour, the starting pixel point and the end pixel point of the contour are determined to be the same pixel point, and the outer contour pixel point coordinate set collects the pixel point twice, and deduplication processing is required to delete the last value of the contour horizontal coordinate set X and the last value of the contour vertical coordinate set Y.

[0112] According to an embodiment of the present invention, calculating a smooth sliding window weighted coefficient array A includes:

[0113] Calculate the original Gaussian ordered array a according to the Gaussian standard deviation σ;

[0114] Each element a in the original Gaussian ordered array a i The calculation method is expressed as:

[0115] ;

[0116] Where e is the natural base, w is the sliding window width, σ is the Gaussian standard deviation, i=0, 1, 2…w-1;

[0117] For each element a in the original Gaussian ordered array a i Perform normalization processing to determine the smooth sliding window weight coefficient A i ;

[0118] ;

[0119] Based on the smooth sliding window weight coefficient A i Create a smooth sliding window weight coefficient array A.

[0120] It should be noted that the Gaussian standard deviation σ is set by the system, and the original Gaussian ordered array a is calculated based on the input Gaussian standard deviation σ and the sliding window width set by the system. Among them, e is the base of the natural logarithm function, which is an infinite non-repeating decimal. Element a i The number of is determined based on the sliding window width w, and the value range of i is 0-w-1. Among them, the smooth sliding window weight coefficient array A is an ordered array.

[0121] According to an embodiment of the present invention, one-dimensional smoothing processing is performed on coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weighted coefficient array A, including:

[0122] For the element X in the contour coordinate set X i Smoothing is performed to obtain element X j ;

[0123] ;

[0124] Among them, X n is the nth element in the contour coordinate set X, A m is the mth element in the smooth sliding window weight coefficient array A;

[0125] According to the element X j For the corresponding element X in the contour coordinate set X i Make updates;

[0126] For the element Y in the contour coordinate set Y i Smoothing is performed to obtain element Y j ;

[0127] ;

[0128] Among them, Y n is the nth element in the contour coordinate set Y, A m is the mth element in the smooth sliding window weight coefficient array A;

[0129] According to the element Y j For the corresponding element Y in the contour coordinate set Y i to update.

[0130] It should be noted that X n The value range of n is from iw / 2 to i+w / 2-1, A m The value of m in the equation ranges from 0 to w-1. Similarly, Y n The value range of n is from iw / 2 to i+w / 2-1, A m The value range of m is 0 to w-1. There is a corresponding relationship between the values ​​of n and m, that is, the system is based on X n or Y n Select the corresponding A m .

[0131] The smoothed element X j and element Y j For each element X in the contour coordinate set X i and the element Y in the contour coordinate set Y i Update to obtain the final contour coordinate set X and contour coordinate set Y.

[0132] According to an embodiment of the present invention, the relative angle amplitude of each coordinate point after one-dimensional smoothing is calculated, and an ordered set C of relative angle amplitudes is established, including:

[0133] According to the coordinate point P i (X i ,Yi ) and the relative spacing coefficient r determine the first coordinate point (X i-r ,Y i-r ) and the second coordinate point (X i+r ,Y i+r );

[0134] Calculate the coordinate point P by using the first coordinate point and the second coordinate point i The relative angle amplitude C i ;

[0135] Relative angle amplitude C i The calculation method is expressed as:

[0136] ;

[0137] Among them, arctan is the inverse trigonometric function, and o is the denominator coefficient constant;

[0138] According to the coordinate point P i The relative angle amplitude C i Establish an ordered set C of relative angle amplitudes.

[0139] It should be noted that the relative spacing coefficient r is a positive integer, and the value of the relative spacing coefficient r is set by those skilled in the art according to actual needs. i The horizontal and vertical coordinates of the point P are determined by adding and subtracting the relative interval coefficient r. i The first coordinate point and the second coordinate point corresponding to the coordinate point P are substituted into the relative angle amplitude calculation formula to determine the coordinate point P i The relative angle amplitude C i According to the relative angle amplitudes of all coordinate points in the outer contour pixel point coordinate set, an ordered set C of relative angle amplitudes is established.

[0140] According to an embodiment of the present invention, a local optimal inflection point is selected according to the relative angle amplitude of each coordinate point to establish an inflection point set R, including:

[0141] The coordinates corresponding to the local maximum and the local minimum in the ordered set C of relative angle amplitudes are determined as the inflection point coordinates;

[0142] The relative angle amplitude C i Less than the preset sharp angle relative amplitude threshold t 0 Filter the inflection point coordinates;

[0143] The inflection point set R is established based on the remaining inflection point coordinates.

[0144] It should be noted that the local maximum and local minimum values ​​in the ordered set C of relative angle amplitudes are determined by the judgment conditions of the local maximum and local minimum values, the coordinate points corresponding to the local maximum and local minimum values ​​are determined as the inflection point coordinates, and then the relative amplitude threshold t is preset. 0 Filtering that does not meet the system preset conditions. Among them, the preset sharp angle relative amplitude threshold t 0 It is set by technicians in this field according to actual needs.

[0145] According to an embodiment of the present invention, the inflection point set R is eliminated based on the smoothness coefficient, including:

[0146] Based on the bottom amplitude coefficient k and the relative angle amplitude C i Calculate the inflection point R i The bottom amplitude f;

[0147] ;

[0148] Among them, k 0 is the bottom amplitude coefficient;

[0149] The inflection point R i The initial value of the first index is set to i, the first index is continuously reduced by 1, and the relative angle amplitude C corresponding to the first index is repeatedly calculated. g , when the relative angle amplitude C corresponding to the first index g Less than C i , determine the final first index g;

[0150] The inflection point R i The initial value of the second index is set to i, the second index is continuously increased by 1, and the relative angle amplitude C corresponding to the second index is repeatedly calculated. h , when the relative angle amplitude C corresponding to the second index h Less than C i , determine the final second index h;

[0151] By the relative angle amplitude C i , bottom amplitude f, first index g and second index h to calculate the inflection point R i The smoothness coefficient k 1 ;

[0152] ;

[0153] The smoothness coefficient k 1 Less than the preset threshold t 1 The inflection point of is removed from the inflection point set R.

[0154] It should be noted that the bottom amplitude coefficient k 0 Set by the system, the inflection point Ri The relative angle amplitude C i and the bottom amplitude coefficient k 0 Multiply to determine the inflection point R i The bottom amplitude f.

[0155] Since the size of the contour horizontal coordinate set X, the contour vertical coordinate set Y and the relative angle amplitude ordered set C are the same, and the ordered sets are sorted in the order of index i. Therefore, index i is universal, that is, the inflection point R can be determined by index i i The horizontal axis is X i , the vertical coordinate is Y i , the relative angle amplitude is C i .

[0156] The inflection point R i The corresponding index i is determined as the initial value of the first index and the initial value of the second index respectively. The relative angle amplitude corresponding to the first index is continuously reduced by 1 and the second index is continuously increased by 1, and the inflection point R is i The relative angle amplitude C i Compare and determine the first index g and the second index h.

[0157] Among them, the preset threshold t 1 It is set by technicians in this field according to actual needs.

[0158] According to an embodiment of the present invention, filtering the inflection points by the coverage strategy corresponding to the inflection points of the local maximum angle amplitude to remove the similar inflection points with lower angle amplitudes in the inflection point set R includes:

[0159] Calculate the inflection point R based on the first index g and the second index h i The coverage u;

[0160] ;

[0161] Among them, k 2 is the coverage factor;

[0162] Analyze based on the coverage range u and determine other inflection points with coordinate indexes within the range of iu and i+u;

[0163] The inflection point R i Determine the inflection points with other inflection points as the similar inflection points, and judge whether the relative angle amplitude corresponding to other inflection points is smaller than the inflection point R i The corresponding relative angle amplitude C i ; If so, remove other inflection points;

[0164] If not, then the inflection point R i To be eliminated.

[0165] It should be noted that the coverage factor k 2 Set by the system, k 0 is the bottom amplitude coefficient. The other inflection points with coordinate indexes within the range of iu and i+u are compared with the inflection point R by covering the range u. i Determined as a similar inflection point, by comparing the other inflection points with the inflection point R i The relative angle amplitude of the inflection point is removed, thereby filtering the inflection points with smaller relative angle amplitudes. Repeat the above operation until the inflection point set R is traversed.

[0166] Figure 4 A block diagram of a machine vision contour sharp corner inflection point recognition system provided by the present invention is shown.

[0167] like Figure 4 As shown, the second aspect of the present invention provides a machine vision contour sharp corner inflection point recognition system, comprising:

[0168] The first analysis module is used to obtain the coordinates of the outer contour pixel points of the product pattern and establish an outer contour pixel point coordinate set; the outer contour pixel point coordinates of the product pattern include the outer contour pixel point horizontal coordinate and the vertical coordinate; the outer contour pixel point coordinate set includes the contour horizontal coordinate set X and the contour vertical coordinate set Y; and the outer contour pixel point coordinate set is subjected to cyclic contour processing;

[0169] The second analysis module is used to calculate the smooth sliding window weight coefficient array A; perform one-dimensional smoothing processing on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weight coefficient array A; calculate the relative angle amplitude of each coordinate point after the one-dimensional smoothing processing, and establish an ordered set C of relative angle amplitudes;

[0170] The third analysis module is used to select the local optimal inflection point according to the relative angle amplitude of each coordinate point and establish the inflection point set R;

[0171] A first inflection point elimination module, used to eliminate inflection points of an inflection point set R based on a smoothing coefficient;

[0172] The second inflection point elimination module is used to filter the similar inflection points with lower angle amplitudes in the inflection point set R after the inflection point elimination through the covering strategy of the inflection point corresponding to the local maximum angle amplitude; and determine the remaining inflection points in the inflection point set R as sharp-angle inflection points.

[0173] The third aspect of the present invention provides a computer-readable storage medium, which includes a machine vision contour sharp corner inflection point recognition method program. When the machine vision contour sharp corner inflection point recognition method program is executed by a processor, the steps of the above-mentioned machine vision contour sharp corner inflection point recognition method are implemented.

[0174] The information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals (including but not limited to signals transmitted between user terminals and other devices, etc.) involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the "outer contour pixel coordinates of the product pattern", "to-be-processed image data I 0 " etc. are all obtained with full authorization.

[0175] The present invention discloses a method and system for identifying sharp corner inflection points of machine vision contours, and the method comprises: obtaining the coordinates of the outer contour pixel points of a product pattern, establishing a set of outer contour pixel point coordinates; performing cyclic contour processing on the set of outer contour pixel point coordinates; calculating a smooth sliding window weighted coefficient array A, and performing one-dimensional smoothing processing on the coordinate points in the set of outer contour pixel point coordinates; calculating the relative angle amplitude of each coordinate point, and establishing an ordered set C of relative angle amplitudes; selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point, and establishing an inflection point set R; removing inflection points from the set of inflection points R based on a rounding coefficient; filtering similar inflection points with lower angle amplitudes in the set of inflection points R after the inflection points are removed by a covering strategy corresponding to the inflection points of the local maximum angle amplitude; and determining the remaining inflection points in the set of inflection points R as sharp corner inflection points. The present invention improves the accuracy and efficiency of sharp corner inflection point recognition by controlling the sharp angle amplitude and the rounding rate.

[0176] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0177] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0178] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0179] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0180] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

Claims

1. A method for identifying sharp corner inflection points of machine vision contours, characterized in that: include: Obtain the coordinates of the outer contour pixel points of the product pattern and establish a set of outer contour pixel point coordinates; The outer contour pixel point coordinates of the product pattern include the outer contour pixel point abscissa and ordinate; the outer contour pixel point coordinate set includes the contour abscissa set X and the contour ordinate set Y; Performing circular contour processing on the outer contour pixel point coordinate set; Calculate the smooth sliding window weight coefficient array A; Performing one-dimensional smoothing processing on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weighted coefficient array A; Calculate the relative angle amplitude of each coordinate point after one-dimensional smoothing, and establish an ordered set C of relative angle amplitudes; Selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point to establish an inflection point set R; Eliminate inflection points from the inflection point set R based on a smoothness coefficient; The inflection points are filtered by the covering strategy of the inflection points corresponding to the local maximum angle amplitude, and the similar inflection points with lower angle amplitudes in the inflection point set R are eliminated; The remaining inflection points in the inflection point set R are determined as sharp-angle inflection points; The removing of inflection points from the inflection point set R based on the smoothness coefficient includes: Based on the bottom amplitude coefficient k and the relative angle amplitude C i Calculate the inflection point R i The bottom amplitude f; f=C i *k0; Among them, k0 is the bottom amplitude coefficient; The inflection point R i The initial value of the first index is set to i, the first index is continuously reduced by 1, and the relative angle amplitude C corresponding to the first index is repeatedly calculated. g , when the relative angle amplitude C corresponding to the first index g Less than C i , determine the final first index g; The inflection point R i The initial value of the second index is set to i, the second index is continuously increased by 1, and the relative angle amplitude C corresponding to the second index is repeatedly calculated. h , when the relative angle amplitude C corresponding to the second index h Less than C i , determine the final second index h; By the relative angle amplitude C i , bottom amplitude f, first index g and second index h to calculate the inflection point R i The smoothness coefficient k1; Eliminate the inflection points whose smoothness coefficient k1 is less than the preset threshold t1 from the inflection point set R; The filtering of the inflection points by the coverage strategy corresponding to the inflection points of the local maximum angle amplitude to remove the similar inflection points with lower angle amplitudes in the inflection point set R includes: Calculate the inflection point R based on the first index g and the second index h i The coverage u; Where k2 is the coverage factor; Analyze according to the coverage range u to determine other inflection points with coordinate indexes within the range of iu and i+u; The inflection point R i and the other inflection points are determined as close inflection points, and it is determined whether the relative angle amplitude corresponding to the other inflection points is smaller than that of the inflection point R i The corresponding relative angle amplitude C i ; If yes, then remove the other inflection points; If not, then the inflection point R i To be eliminated.

2. The method for identifying sharp corner inflection points of machine vision contours according to claim 1, characterized in that: The step of obtaining the coordinates of the outer contour pixel points of the product pattern and establishing a set of the outer contour pixel point coordinates includes: Obtain image data to be processed I0; Performing grayscale processing and binarization operations on the image data to be processed I0 to obtain pre-processed image data I1; Performing an outer contour filling operation on the pre-processed image data I1 to obtain filled image data I2; The horizontal coordinates and vertical coordinates of all the outer contour pixel points in the filled image data I2 are added to the contour horizontal coordinate set X and the contour vertical coordinate set Y respectively according to the outer contour arrangement order to determine the outer contour pixel point coordinate set.

3. The method for identifying sharp corner inflection points of machine vision contours according to claim 1, characterized in that: The performing circular contour processing on the outer contour pixel point coordinate set comprises: Determine whether the first and last values ​​of the contour horizontal coordinate set X are the same; Determine whether the first and last values ​​of the contour ordinate set Y are the same; When the first value and the last value of the contour horizontal coordinate set X are the same, and the first value and the last value of the contour vertical coordinate set Y are also the same, then the outer contour pixel point coordinate set is determined to be a circular contour; The last value of the contour abscissa set X and the last value of the contour ordinate set Y are deleted.

4. The method for identifying sharp corner inflection points of machine vision contours according to claim 1, characterized in that: The calculation of the smooth sliding window weighted coefficient array A includes: Calculate the original Gaussian ordered array a according to the Gaussian standard deviation σ; Each element a in the original Gaussian ordered array a i The calculation method is expressed as: Where e is the natural base, w is the sliding window width, σ is the Gaussian standard deviation, i = 0, 1, 2…w-1; For each element a in the original Gaussian ordered array a i Perform normalization processing to determine the smooth sliding window weight coefficient A i ; Based on the smooth sliding window weight coefficient A i Create a smooth sliding window weight coefficient array A.

5. The method for identifying sharp corner inflection points of machine vision contours according to claim 4, characterized in that: The one-dimensional smoothing process is performed on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weighted coefficient array A, comprising: For the element X in the contour coordinate set X i Smoothing is performed to obtain element X j ; Among them, X n is the nth element in the contour coordinate set X, A m is the mth element in the smooth sliding window weight coefficient array A; According to the element X j For the corresponding element X in the contour coordinate set X i Make updates; For the element Y in the contour coordinate set Y i Smoothing is performed to obtain element Y j ; Among them, Y n is the nth element in the contour coordinate set Y, A m is the mth element in the smooth sliding window weight coefficient array A; According to the element Y j For the corresponding element Y in the contour coordinate set Y i to update.

6. The method for identifying sharp corner inflection points of machine vision contours according to claim 1, characterized in that: The step of calculating the relative angle amplitude of each coordinate point after one-dimensional smoothing to establish an ordered set C of relative angle amplitudes includes: According to the coordinate point P i (X i ,Y i ) and the relative spacing coefficient r determine the first coordinate point (X i-r ,Y i-r ) and the second coordinate point (X i+r ,Y i+r ); The coordinate point P is calculated by using the first coordinate point and the second coordinate point i The relative angle amplitude C i ; The relative angle amplitude C i The calculation method is expressed as: Among them, arctan is the inverse trigonometric function, and o is the denominator coefficient constant; According to the coordinate point P i The relative angle amplitude C i Establish an ordered set C of relative angle amplitudes.

7. The method for identifying sharp corner inflection points of machine vision contours according to claim 1, characterized in that: The step of selecting a local optimal inflection point according to the relative angle amplitude of each coordinate point and establishing an inflection point set R comprises: The coordinates corresponding to the local maximum and the local minimum in the ordered set C of relative angle amplitudes are determined as the inflection point coordinates; The relative angle amplitude C i The inflection point coordinates that are less than the preset sharp angle relative amplitude threshold t0 are filtered; The inflection point set R is established based on the remaining inflection point coordinates.

8. A machine vision contour sharp corner inflection point recognition system, used to implement the machine vision contour sharp corner inflection point recognition method according to any one of claims 1 to 7, characterized in that: include: The first analysis module is used to obtain the coordinates of the outer contour pixel points of the product pattern and establish a set of outer contour pixel point coordinates; The outer contour pixel point coordinates of the product pattern include the outer contour pixel point abscissa and ordinate; the outer contour pixel point coordinate set includes the contour abscissa set X and the contour ordinate set Y; and the outer contour pixel point coordinate set is subjected to cyclic contour processing; The second analysis module is used to calculate the smooth sliding window weight coefficient array A; perform one-dimensional smoothing processing on the coordinate points in the outer contour pixel point coordinate set based on the smooth sliding window weight coefficient array A; calculate the relative angle amplitude of each coordinate point after the one-dimensional smoothing processing, and establish an ordered set C of relative angle amplitudes; A third analysis module is used to select a local optimal inflection point according to the relative angle amplitude of each coordinate point and establish an inflection point set R; A first inflection point elimination module, configured to eliminate inflection points of the inflection point set R based on a smoothing coefficient; The second inflection point elimination module is used to filter the similar inflection points with lower angle amplitudes in the inflection point set R after the inflection point elimination through the covering strategy of the inflection point corresponding to the local maximum angle amplitude; The remaining inflection points in the inflection point set R are determined as sharp-angle inflection points; The removing of inflection points from the inflection point set R based on the smoothness coefficient includes: Based on the bottom amplitude coefficient k and the relative angle amplitude C i Calculate the inflection point R i The bottom amplitude f; f=C i *k0; Among them, k0 is the bottom amplitude coefficient; The inflection point R i The initial value of the first index is set to i, the first index is continuously reduced by 1, and the relative angle amplitude C corresponding to the first index is repeatedly calculated. g , when the relative angle amplitude C corresponding to the first index g Less than C i , determine the final first index g; The inflection point R i The initial value of the second index is set to i, the second index is continuously increased by 1, and the relative angle amplitude C corresponding to the second index is repeatedly calculated. h , when the relative angle amplitude C corresponding to the second index h Less than C i , determine the final second index h; By the relative angle amplitude C i , bottom amplitude f, first index g and second index h to calculate the inflection point R i The smoothness coefficient k1; Eliminate the inflection points whose smoothness coefficient k1 is less than the preset threshold t1 from the inflection point set R; The filtering of the inflection points by the coverage strategy corresponding to the inflection points of the local maximum angle amplitude to remove the similar inflection points with lower angle amplitudes in the inflection point set R includes: Calculate the inflection point R based on the first index g and the second index h i The coverage u; Where k2 is the coverage factor; Analyze according to the coverage range u to determine other inflection points with coordinate indexes within the range of iu and i+u; The inflection point R i and the other inflection points are determined as close inflection points, and it is determined whether the relative angle amplitude corresponding to the other inflection points is smaller than that of the inflection point R i The corresponding relative angle amplitude C i ; If yes, then remove the other inflection points; If not, then the inflection point R i To be eliminated.

Citation Information

Patent Citations

  • Constraint inflection point line highway visibility detection method

    CN110287885A

  • Branch road filtering method and device based on inflection point identification and skeleton line extraction

    CN118411378A