Industrial part comprehensive positioning method and system based on edge contour and feature matrix
By optimizing the image matching algorithm using edge contours and feature moments, the time-consuming problem caused by deformation, scaling, and lighting changes in industrial environments is solved, achieving efficient and accurate positioning of industrial parts.
Patent Information
- Application Number
- CN202310826067.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2043-07-07
AI Technical Summary
Existing image matching algorithms are too time-consuming in industrial environments due to deformation, scaling, and changes in lighting, making it difficult to meet actual production needs.
The matching process is optimized by using edge contour and feature moments, including image preprocessing, edge extraction, contour filtering, feature H-moment calculation, and angle difference correction.
It reduces the computation time of the algorithm, improves the accuracy and speed of matching, and is suitable for test objects placed in a dispersed and non-overlapping manner in industrial environments.
Smart Images

Figure CN117011376B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial part positioning, and particularly relates to an industrial part comprehensive positioning method and system based on edge contours and feature matrices. BACKGROUND
[0002] A visual algorithm is an algorithm based on computer vision technology, and its main purpose is to solve various problems involved in image or video processing. The visual algorithm is a very important field, and its application range is very wide, such as image segmentation, target tracking, object recognition and face recognition. At present, the visual algorithm matching positioning demand in the industrial environment is mainly used for production and detection of the flow line, and the shooting distance, the light environment and the model to be positioned are basically consistent. The types of the objects to be detected are mainly normal parts, a small amount of which are damaged or stained. The detection requirement is mainly in positioning, and the basic requirement is to obtain the result in real time.
[0003] However, the existing image matching algorithm pays more attention to the matching stability and accuracy in abnormal conditions, and maintains the usability of matching in the conditions such as deformation, scaling, light change and template image change which are basically not encountered in the industrial environment, so as to cause high time consumption, which does not meet the actual production demand. SUMMARY
[0004] In view of the deficiencies in the prior art, the present application provides an industrial part comprehensive positioning method and system based on edge contours and feature matrices, so as to solve the technical problem that the image matching algorithm in the prior art pays more attention to the matching stability and accuracy in abnormal conditions, and maintains the usability of matching in the conditions such as deformation, scaling, light change and template image change which are basically not encountered in the industrial environment, so as to cause high time consumption, which does not meet the actual production demand.
[0005] The present application provides an industrial part comprehensive positioning method based on edge contours and feature matrices, comprising:
[0006] S1, acquiring image information of an object to be detected by a camera device, and performing a fixed value preprocessing on the image information;
[0007] S2, performing edge extraction on the image information, and extracting a contour of the object to be detected in the image information;
[0008] S3, screening the extracted contour, and retaining an effective object to be detected contour and a template contour;
[0009] S4, a central moment matrix of the image information is calculated, feature H moments of the to-be-tested contour and the template contour are respectively calculated based on the central moment matrix, the feature H moments are subjected to logarithmic change, I1 distances between the feature H moments of all the to-be-tested contours and the template contour are calculated, and a to-be-tested contour with the minimum I1 distance is selected as an optimal to-be-tested contour;
[0010] S5, a first angle difference value of an edge point set of the template contour and an edge point set of the optimal to-be-tested contour is calculated, a second angle difference value is calculated through the central moment matrix, and an absolute error difference value between the first angle difference value and the second angle difference value is calculated; the absolute error difference value is compared with a preset accuracy value, if the absolute error difference value is less than the preset accuracy value, a mean value of the two is output as an angle direction result, otherwise, an actual rotation angle is recalculated as the angle direction result;
[0011] S6, the optimal to-be-tested contour and the angle direction result are output as a final matching result.
[0012] Optionally, the extracted contours are screened, and valid to-be-tested contours and template contours are reserved, including:
[0013] Firstly, the L1 distance is subjected to a first screening through a teh-Chinl chain approximation algorithm, then the L2 distance is subjected to a second screening, and finally, a perimeter and an area of the template contour and the to-be-tested contour are calculated, an error value P is calculated according to the perimeter and the area, a shape contour different from the template contour is removed according to the error value P, and valid to-be-tested contours and template contours are reserved;
[0014] The contours are screened, and valid to-be-tested contours and template contours are reserved;
[0015] The L1 distance is Manhattan distance, and is expressed as:
[0016] L1 = |x1-x2| + |y1-y2|
[0017] The L2 distance is Euclidean distance, and is expressed as:
[0018]
[0019] The error value P is calculated in the following manner:
[0020]
[0021] Optionally, the central moment matrix of the image information is calculated, including:
[0022] A third-order central moment matrix of the image information is calculated through a moments function, wherein nu jidenotes the normalized central moments in the third order central moment matrix:
[0023]
[0024] m ji denotes the spatial moments in the third order central moment matrix:
[0025]
[0026] mu ji denotes the central moments in the third order central moment matrix:
[0027]
[0028] Optionally, the calculating the feature H-moments of the to-be-tested profile and the template profile based on the central moment matrix respectively comprises:
[0029] The calculating method of the feature H-moments is:
[0030] h[0] = η 20 + η 02
[0031] h[1] = (η 20 - η 02 ) 2 + 4η 11 2
[0032] h[2] = (η 30 - 3η 12 ) 2 + (3η 21 - η 03 ) 2
[0033] h[3] = (η 30 + η 12 ) 2 + (η 21 + η 03 ) 2
[0034] h[4] = (η 30 - 3η 12 )(η 30 + η 12 )[(η 30 + η 12 ) 2 - 3(η 21 + η 03 ) 2 ] + (3η 21 - η 03 )(η 21 + η03 )[3(η
[0035] 30 +η 12 ) 2 -(η 21 +η 03 ) 2 ]
[0036] h[5]=(η 20 -η 02 )[(η 30 +η 12 ) 2 -(η 21 +η 03 ) 2 ]+4η11(η 30 +η 12 )(η 21 +η 03 )
[0037] h[6]=(3η 21 -η 03 )(η 21 +η 03 )[3(η 30 +η 12 ) 2 -(η 21 +η 03 ) 2 ]-(η 30 -3η 12 )(η 21 +η 03 )[3(η
[0038] 30 +η 12 ) 2 -(η 21 +η 03 ) 2 ]。
[0039] Optionally, the I1 distance between the feature H moments of all the to-be-tested contours and the template contour is calculated, comprising:
[0040] The I1 distance is calculated as follows:
[0041]
[0042] Optionally, the first angle difference between the edge point set of the template contour and the edge point set of the optimal to-be-tested contour is calculated, comprising:
[0043] The edge point set of the template profile and the edge point set of the optimal profile to be measured are reduced to one-dimensional vectors by a PCA algorithm respectively, to obtain PCA angles of the one-dimensional vectors, and a first angle difference PA is calculated.
[0044] Optionally, the second angle difference is calculated by the central moment matrix, and an absolute error difference between the first angle difference and the second angle difference is calculated, including:
[0045] A matrix angle is obtained by the central moment matrix, a second angle difference PB is calculated, and an absolute error PC between the first angle difference PA and the second angle difference PB is calculated.
[0046] Optionally, the actual rotation angle is recalculated as the angle direction result in the opposite case, including:
[0047] The edge point set of the template profile is rotated by the first angle difference PA and the second angle difference PB respectively, and error distances between the two rotated point sets and the edge point set of the optimal profile to be measured are calculated, so that the error distance is calculated in the following manner:
[0048]
[0049] The rotated point set with a smaller error distance is selected as the rotation result, and the angle of the rotated point set is the angle direction result.
[0050] The application further provides an industrial part comprehensive positioning system based on edge profiles and feature moments, including:
[0051] A preprocessing module is configured to acquire image information of an object to be measured by a camera device and perform fixed-value preprocessing on the image information.
[0052] An edge extraction module is configured to perform edge extraction on the image information to extract a profile of the object to be measured in the image information.
[0053] A profile screening module is configured to screen the extracted profile to retain an effective profile to be measured and a template profile.
[0054] A profile matching module is configured to calculate a central moment matrix of the image information, calculate feature H moments of the profile to be measured and the template profile based on the central moment matrix, perform logarithmic change on the feature H moments, finally calculate I1 distances between the feature H moments of all the profiles to be measured and the template profile, and select a profile to be measured with the smallest I1 distance as an optimal profile to be measured.
[0055] The angle direction repairing module is used for calculating a first angle difference value of edge point sets of the template profile and the optimal profile to be measured, calculating a second angle difference value through the center moment matrix, and calculating an absolute error difference value between the first angle difference value and the second angle difference value; the absolute error difference value is compared with a preset accuracy value, if the absolute error difference value is less than the preset accuracy value, the average of the two is taken as an angle direction result, otherwise, the actual rotation angle is recalculated as the angle direction result;
[0056] The output module is used for outputting the optimal profile to be measured and the angle direction result as a final matching result.
[0057] Compared with the prior art, the present application has the following beneficial effects:
[0058] 1. Based on the value setting preprocessing of image information, the operation time of subsequent algorithms is reduced, and the accuracy is improved.
[0059] 2. The image information is edge extracted, and the situation of the measured objects which are placed in a scattered and non-overlapping manner in an industrial environment can be prepared.
[0060] 3. The profile is screened, the redundant meaningless points and the repeated points with small intervals are removed, and the subsequent interference problem is avoided. BRIEF DESCRIPTION OF DRAWINGS
[0061] The drawings incorporated into the specification and constituting a part of the specification, show embodiments consistent with the present application, and together with the specification, serve to explain the principles of the present application.
[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced as follows, and obviously, other drawings can also be obtained by those skilled in the art without creative labor.
[0063] Figure 1 The flowchart in the present application;
[0064] Figure 2 The schematic diagram of the value setting preprocessing of image information before the present application;
[0065] Figure 3 The schematic diagram of the value setting preprocessing of image information after the present application;
[0066] Figure 4 The schematic diagram of edge extraction in the present application, left 0 and right 1 are starting points;
[0067] Figure 5 The schematic diagram of edge extraction counterclockwise search and value assignment in the present application;
[0068] Figure 6 For the edge extraction search in the present application, the edge level is assigned according to the schematic diagram before completion;
[0069] Figure 7 For the edge extraction search in the present application, the edge level is assigned according to the schematic diagram after completion;
[0070] Figure 8 For the L1 distance and L2 distance in the present application, the schematic diagram is shown;
[0071] Figure 9 For the H-moment logarithmic transformation of the feature under common changes in the present application, the schematic diagram is shown;
[0072] Figure 10 For the PCA dimension reduction idea in the present application, the schematic diagram is shown;
[0073] Figure 11 For the PCA angle calculation and rotation to 0 in the present application, the schematic diagram is shown. DETAILED DESCRIPTION
[0074] To make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application. The function units with the same and similar structures and functions in the examples of the present application have the same and similar structures and functions.
[0075] Referring to Figure 1 The present application provides an industrial part comprehensive positioning method based on edge contour and feature moment, comprising:
[0076] S1, acquiring image information of a to-be-measured object by a camera device, and performing value-setting preprocessing on the image information;
[0077] S2, performing edge extraction on the image information to extract a contour of the to-be-measured object in the image information;
[0078] S3, screening the extracted contour to retain effective to-be-measured contours and template contours;
[0079] S4, calculating a central moment matrix of the image information, calculating feature H moments of the to-be-measured contours and the template contours based on the central moment matrix respectively, performing logarithmic transformation on the feature H moments, finally calculating I1 distances between all the feature H moments of the to-be-measured contours and the template contours, and selecting a to-be-measured contour with the smallest I1 distance as an optimal to-be-measured contour.
[0080] S5, calculate the first angle difference value of the edge point set of the template contour and the edge point set of the optimal to-be-measured contour, calculate the second angle difference value through the central moment matrix, and calculate the absolute error difference value between the first angle difference value and the second angle difference value; the absolute error difference value is judged with the preset precision value, if the absolute error difference value is less than the preset precision value, the average value of the two is output as the angle direction result, otherwise the actual rotation angle is recalculated as the angle direction result;
[0081] S6, output the optimal to-be-measured contour and the angle direction result as the final matching result.
[0082] In this embodiment, S1, the image information of the to-be-measured object is obtained through the camera device, and the image information is subjected to a fixed value preprocessing.
[0083] Referring to Figure 2 and Figure 3 Due to the stability of the industrial environment shooting, compared with the general algorithm, the image is additionally subjected to a fixed value preprocessing, the process includes common gray, dilate, erode, image pyramid, contrast adjustment, etc., which reduces the operation time consumption of the subsequent algorithm and improves the accuracy.
[0084] S2, edge extraction is performed on the image information, and the contour of the to-be-measured object in the image information is extracted.
[0085] Referring to Figure 4 - Figure 7 From the top left corner of the picture, traverse the whole picture from left to right and from top to bottom, and set the first point found in the traversal process as the starting point of the outer edge of the object (left 1 right 0 is the inner edge), and then use the boundary search algorithm to find all adjacent points to form the outer edge in a counterclockwise order. The essence of boundary search is to check the continuity of adjacent points, that is, from the starting point, iteratively search whether the 8 adjacent points of the starting point are 1. Because the boundary is tracked in a counterclockwise direction, the query of the surrounding adjacent points should also be counterclockwise. The adjacent points are found in a loop, and the previous center point is taken as a new starting point, and the new adjacent point found is taken as a new center point. This process is repeated until the new adjacent point found is the boundary starting point or there is no next new adjacent point. The point set composed of a complete set of starting point-center point-adjacent point can determine a continuous boundary condition. The approximate contour and position of the object in the template picture and the to-be-measured picture are extracted to depict the distribution of the commonly scattered and non-overlapping parts in the industrial environment.
[0086] S3, the extracted contour is screened, and the effective to-be-measured contour and the template contour are retained.
[0087] Referring to Figure 8 , the extracted contour often has some problems such as partial overlap, incompleteness, and abnormal point set due to actual interference. Therefore, the L1 distance is evaluated and filtered by the teh-Chinl chain approximation algorithm to remove redundant meaningless points and retain more characteristic point sets. Then, the L2 distance is used for second filtering, and the relative distance L2 is calculated by traversing the points in the contour to remove repeated points and meaningless points with small interval distance. After the points in the contour are filtered, the distance between the contour points and other contour edge points outside is calculated to filter the repeated contours. Finally, the perimeter and area of the template contour and the to-be-measured contour are calculated, and the error value P is calculated based on the template contour. According to the P value, the shape contour that is greatly different from the template contour (such as a halo point, a stain, an unclosed linear edge, and an internal edge without effective features) is removed. The finally retained contour after filtering is the effective to-be-measured contour.
[0088] wherein, wherein the L1 distance is the Manhattan distance, which is represented as:
[0089] L1 = |x1-x2| + |y1-y2|
[0090] The L2 distance is the Euclidean distance, which is represented as:
[0091]
[0092] The error value P is calculated in the following manner:
[0093]
[0094] GS and GC are preset weight values according to the template shape.
[0095] S4, a central moment matrix of the image information is calculated, the features H moments of the to-be-measured contour and the template contour are calculated based on the central moment matrix, the features H moments are subjected to logarithmic change, the I1 distance between all the features H moments of the to-be-measured contour and the template contour is calculated, and the to-be-measured contour with the smallest I1 distance is selected as the optimal to-be-measured contour.
[0096] Referring to Figure 9 The image is regarded as a numerical matrix, and the existing moments function is used to obtain the third-order central moment matrix (24 values) of the numerical matrix. For the numerical matrix, the central moment matrix describes the characteristics of the numerical values, such as symmetry, mean value, gradient change, etc. For the image, the central moment matrix describes some geometric features of the image, such as size, centroid, moment of inertia, gray value, direction, etc.
[0097] wherein nu jidenotes the normalized central moments in the third order central moment matrix:
[0098]
[0099] m ji denotes the spatial moments in the third order central moment matrix:
[0100]
[0101] mu ji denotes the central moments in the third order central moment matrix:
[0102]
[0103] Since the numerical range of each dimension is too large to compare, a logarithmic transformation is first made to bring them into the same range:
[0104] H i = -sign(h i ) log |h i |
[0105] Then the feature h-moments of the template profile and all the profiles to be tested are calculated. The feature h-moments are based on the central moment matrix, and the parameters related to the matching of the object are extracted and weighted to form 7 dimensions. The calculation method is:
[0106] h[0] = η 20 + η 02
[0107] h[1] = (η 20 - η 02 ) 2 + 4η 11 2
[0108] h[2] = (η 30 - 3η 12 ) 2 + (3η 21 - η 03 ) 2
[0109] h[3] = (η 30 + η 12 ) 2 + (η 21 + η 03 ) 2
[0110] h[4] = (η 30 - 3η 12 )(η 30 + η 12 )[(η 30 + η12 2 -3(η 21 +η 03 ) 2 +3(η 21 -η 03 )(η 21 +η 03 )[3(η
[0111] 30 +η 12 ) 2 -3(η 21 +η 03 ) 2
[0112] h[5] = (η 20 -η 02 )[(η 30 +η 12 ) 2 -η 21 +η 03 ] 2 +4η11(η 30 +η 12 )(η 21 +η 03 )
[0113] h[6] = (3η 21 -η 03 )(η 21 +η 03 )[3(η 30 +η 12 ) 2 -η 21 +η 03 ] 2 -(η 30 -3η 12 )(η 21 +η 03 )[3(η
[0114] 30 +η 12 ) 2 -η 21 +η 03 ] 2 .
[0115] The h-moments of the profile A to be measured and the template profile B are compared. The I1 distance of the h-moments of the two edges is calculated, and the smaller the distance value I1, the closer the shape. Thus the correlation of the profile to be measured and the template profile is determined.
[0116] The calculation method of the I1 distance is as follows:
[0117]
[0118] Repeat the foregoing steps to compare all the profiles to be tested, wherein the profile with the highest degree of matching is the matching result, and the center point of the profile is the matching center point. The method used for matching comparison is the feature h-moment of partial edge features, rather than the entire image or edge image point set. By performing numerical processing on the image in advance, the operation time of the matching part is shortened.
[0119] S5, calculate the first angle difference value of the edge point set of the template profile and the edge point set of the optimal profile to be tested; calculate the second angle difference value through the center moment matrix, and calculate the absolute error difference value between the first angle difference value and the second angle difference value; judge the absolute error difference value and the preset accuracy value, if the absolute error difference value is less than the preset accuracy value, take the average of both as the angle direction result, otherwise recalculate the actual rotation angle as the angle direction result.
[0120] Since the center moment matrix is mainly a description of numerical values, there is a loss of angle information of the actual object. After obtaining the matching center point by the above method, the direction angle needs to be repaired by the PCA angle.
[0121] Referring to Figure 10 , the edge point set of the template profile and the edge point set of the optimal profile to be tested are reduced to one-dimensional vectors by the PCA algorithm respectively, the PCA angle of the one-dimensional vector is obtained, and the first angle difference value PA is calculated; the matrix angle is obtained by the center moment matrix respectively, the second angle difference value PB is calculated, and the absolute error value PC of the first angle difference value PA and the second angle difference value PB is calculated.
[0122] Referring to Figure 11 , according to the pre-set accuracy judgment value PP (based on the requirement of the actual environment for angle accuracy and speed), the absolute error difference value is judged with the preset accuracy value, if the absolute error difference value PC is less than the preset accuracy value PP, it is determined that the angle feature of the object is obvious, the angle loss of the matrix operation is within the acceptable range, the average of the first angle difference value PA and the second angle difference value PB is taken as the angle direction result, otherwise it is determined that the angle feature of the object is not obvious, the angle loss of the matrix operation exceeds the requirement, and the actual rotation angle needs to be recalculated.
[0123] The edge point set of the template profile is rotated by the first angle difference value PA and the second angle difference value PB respectively, and the error distance between the two rotated point sets and the edge point set of the optimal profile to be tested is calculated, so the error distance is calculated as follows:
[0124]
[0125] Select the rotation point set with smaller error distance as the rotation result, and the angle (PA or PB) rotated by the rotation point set is the angle direction result.
[0126] S6, output the optimal to-be-measured contour and the angle direction result as the final matching result.
[0127] The present application reduces the operation time of the subsequent algorithm based on the preprocessing of the image information, improves the accuracy, extracts the edge of the image information, can prepare the common dispersed and non-overlapping placed to-be-measured object in the industrial environment, filters the contour, removes the redundant meaningless points and the repeated points with too small interval, avoids the subsequent interference problem, and improves the speed and accuracy of the matching algorithm.
[0128] The present application also provides an industrial part comprehensive positioning system based on edge contour and feature matrix, comprising:
[0129] A preprocessing module is configured to acquire image information of a to-be-measured object by a camera device, and perform value-based preprocessing on the image information.
[0130] An edge extraction module is configured to perform edge extraction on the image information, and extract a contour of the to-be-measured object in the image information.
[0131] A contour filtering module is configured to filter the extracted contour, and retain an effective to-be-measured contour and a template contour.
[0132] A contour matching module is configured to calculate a center moment matrix of the image information, calculate feature H moments of the to-be-measured contour and the template contour based on the center moment matrix, perform logarithmic change on the feature H moments, finally calculate I1 distances between the feature H moments of all the to-be-measured contours and the template contour, and select a to-be-measured contour with the smallest I1 distance as an optimal to-be-measured contour.
[0133] An angle direction repairing module is configured to calculate a first angle difference value of edge point sets of the template contour and the optimal to-be-measured contour, calculate a second angle difference value through the center moment matrix, calculate an absolute error difference value between the first angle difference value and the second angle difference value, judge the absolute error difference value and a preset accuracy value, if the absolute error difference value is smaller than the preset accuracy value, take the average of the two as an angle direction result, otherwise, recalculate an actual rotation angle as an angle direction result.
[0134] An output module is configured to output the optimal to-be-measured contour and the angle direction result as a final matching result.
[0135] It has to be noted that, in the present document, relational terms are intended only to convey a possible relationship between elements or
[0136] The above description is merely that of the specific embodiments of the application and as such is not to be taken in a limiting sense, as the specific embodiments merely exemplify the general principles of the application. Certain modifications to the specific embodiments disclosed above can be apparent to one skilled in the art with the benefit of the present disclosure, and as such, should be within the purview of the application defined by the following claims, and their equivalents.
Claims
1. An industrial part comprehensive positioning method based on edge contour and feature moment, characterized in that, The method comprises the following steps: S1, acquiring image information of an object to be measured by a camera device, and performing value setting preprocessing on the image information; S2, performing edge extraction on the image information to extract the outline of the object to be measured in the image information; S3, screening the extracted outline to retain effective object to be measured outline and template outline; S4, calculating the central moment matrix of the image information, calculating the feature H-moment of the object to be measured outline and the template outline based on the central moment matrix, performing logarithmic change on the feature H-moment, finally calculating the I1 distance between the feature H-moments of all the object to be measured outlines and the template outline, and selecting the object to be measured outline with the smallest I1 distance as the optimal object to be measured outline; S5, calculating the first angle difference value of the edge point set of the template outline and the edge point set of the optimal object to be measured outline, calculating the second angle difference value through the central moment matrix, and calculating the absolute error difference value between the first angle difference value and the second angle difference value; judging the absolute error difference value and the preset accuracy value, if the absolute error difference value is smaller than the preset accuracy value, taking the average of the two as the angle direction result, otherwise, recalculating the actual rotation angle as the angle direction result; S6, outputting the optimal object to be measured outline and the angle direction result as the final matching result.
2. The method of claim 1, wherein, The screening of the extracted outline to retain effective object to be measured outline and template outline comprises: firstly, performing first screening on the L1 distance by using teh-Chinl chain approximation algorithm, then performing second screening by using L2 distance, finally calculating the perimeter and area of the template outline and the object to be measured outline, and calculating the error value P according to the perimeter and area, removing the shape outline different from the template outline according to the error value P, and retaining the effective object to be measured outline and the template outline; screening repeated outlines to retain effective object to be measured outline and template outline; wherein, the L1 distance is Manhattan distance, expressed as: L1=|x1-x2|+|y1-y2| the L2 distance is Euclidean distance, expressed as: The calculation method of the error value P is:
3. The method of claim 2, wherein, The calculation of the central moment matrix of the image information comprises: The third order central moment matrix of the image information is calculated using the moments function, wherein nu ji represents the normalized central moments in the third order central moment matrix: m ji denotes the spatial moments in the third order central moment matrix: mu ji denotes the central moment in the third order central moment matrix:
4. The method of claim 3, wherein, The calculation of the feature H-moment of the object to be measured outline and the template outline based on the central moment matrix comprises: The calculation method of the feature H-moment is: h[0] = η 20 + η 02 h[1] = (η 20 -η 02 ) 2 +4η 11 2 h[2] = (η 30 - 3η 12 ) 2 + (3η 21 - η 03 ) 2 h[3] = (η 30 + η 12 ) 2 + (η 21 + η 03 ) 2 h[4] = (η 30 - 3η 12 )(η 30 + η 12 )[(η 30 + η 12 ) 2 - 3(η 21 + η 03 ) 2 ] + (3η 21 - η 03 )(η 21 + η 03 )[3(η 30 + η 12 ) 2 - (η 21 + η 03 ) 2 ] h[5] = (η 20 - η 02 )[(η 30 + η 12 ) 2 - (η 21 + η 03 ) 2 ]+ 4η11(η 30 + η 12 )(η 21 + η 03 ) h[6] = (3η 21 - η 03 )(η 21 + η 03 )[3(η 30 + η 12 ) 2 - (η 21 + η 03 ) 2 ] - (η 30 - 3η 12 )(η 21 + η 03 )[3(η 30 + η 12 ) 2 - (η 21 + η 03 ) 2 ].
5. The method of claim 4, wherein, The logarithmic change of the feature H-moment comprises: The calculation method of the logarithmic change is: H i = -sign(h i ) log |h i |.
6. The method of claim 5, wherein, The final calculation of the I1 distance between the feature H-moments of all the object to be measured outlines and the template outline comprises: The calculation method of the I1 distance is:
7. The method of claim 6, wherein, The calculation of the first angle difference value of the edge point set of the template outline and the edge point set of the optimal object to be measured outline comprises: The edge point set of the template outline and the edge point set of the optimal object to be measured outline are reduced to one-dimensional vectors by PCA algorithm to obtain the PCA angle of the one-dimensional vector, and the first angle difference value PA is calculated.
8. The method of claim 7, wherein, The calculation of the second angle difference value through the central moment matrix, and the calculation of the absolute error difference value between the first angle difference value and the second angle difference value comprise: The center moment matrix is used to obtain a matrix angle, and a second angle difference PB is calculated, and an absolute error value PC of the first angle difference PA and the second angle difference PB is calculated.
9. The method of claim 8, wherein, The actual rotation angle is recalculated as the angle direction result, including: The edge point set of the template profile is rotated by the first angle difference PA and the second angle difference PB, respectively, and the error distances between the two rotated point sets and the edge point set of the optimal test profile are calculated, so that the error distance is calculated in the following manner: The rotated point set with the smaller error distance is selected as the rotation result, and the angle of the rotated point set is the angle direction result.
10. An industrial part comprehensive positioning system based on edge profile and moment of features, characterized in that, Including: The preprocessing module is used to obtain image information of a test object through a camera device and perform a fixed-value preprocessing on the image information. The edge extraction module is used to perform edge extraction on the image information to extract a profile of the test object in the image information. The profile screening module is used to screen the extracted profile to retain an effective test profile and a template profile. The profile matching module is used to calculate a center moment matrix of the image information, calculate feature H moments of the test profile and the template profile based on the center moment matrix, perform logarithmic change on the feature H moments, finally calculate I1 distances between the feature H moments of all the test profiles and the template profiles, and select a test profile with the smallest I1 distance as an optimal test profile. The angle direction repair module is used to calculate a first angle difference between an edge point set of the template profile and an edge point set of the optimal test profile, calculate a second angle difference through the center moment matrix, calculate an absolute error difference between the first angle difference and the second angle difference, judge the absolute error difference and a preset accuracy value, if the absolute error difference is smaller than the preset accuracy value, output an average value of the two as the angle direction result, otherwise, recalculate an actual rotation angle as the angle direction result. The output module is used to output the optimal test profile and the angle direction result as a final matching result.
Citation Information
Patent Citations
Visual detection method for robot to grab parts
CN111126174A
Curve positioning algorithm and system based on edge contour
CN115880481A