A method for detecting surface flatness of fixture used in mechanical production

Through Hough space analysis of the edge pixel points and circular fit characteristics of the surface holes of the mechanical production fixture, combined with the symmetry characteristics of the curve intersection distribution, the flatness of the fixture surface is detected, which solves the high detection cost and accuracy of the existing technology. Minimize the problem and ensure the production quality.

CN118229679BActive Publication Date: 2024-09-03XIAN JIAOTONG ENG COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410634976.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-09-03
Estimated Expiration
2044-05-22

AI Technical Summary

Technical Problem

In the existing technology, surface flatness detection of fixtures used in mechanical production is costly and inefficient, and computer vision-based detection is easily interfered by the flatness features of non-hole areas, resulting in errors in detection results and affecting production quality.

Method used

By obtaining the fixture surface image for edge detection and converting it to Hough space, combined with the number of curve intersections, the distribution characteristics of circle and grid intersections, and the distribution characteristics of edge pixels, the initial flatness is obtained, and the symmetry characteristics of the holes are analyzed by adjusting the Hough space , and finally evaluate the surface flatness.

Benefits of technology

It improves the accuracy of surface flatness detection of fixtures used in mechanical production, reduces detection costs, and ensures production quality and safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118229679B
    Figure CN118229679B
Patent Text Reader

Abstract

The present invention relates to the technical field of image structure feature extraction, and specifically to a method for detecting the surface flatness of a fixture for mechanical production. The present invention first obtains a fixture surface image, performs edge detection on the fixture surface image and converts it into a Hough space; further obtains the initial flatness corresponding to each curve intersection in the Hough space; further adjusts the Hough space; further analyzes the distribution characteristics of each curve intersection, and obtains the final flatness corresponding to each curve intersection in combination with the initial flatness of each curve intersection; finally, the surface flatness of the mechanical production fixture is detected based on all the final flatnesses. The present invention is aimed at a mechanical production fixture with symmetrical features, and uses the Hough space to analyze the fitting characteristics of the edge pixel points of the holes on the surface of the mechanical production fixture and the circle, and detects the flatness of the fixture surface in combination with the symmetrical characteristics of the holes reflected by the distribution of the curve intersections, thereby ensuring production quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image structure feature extraction, and in particular to a method for detecting the surface flatness of a fixture used in mechanical production. Background Art

[0002] Generally, mechanical production fixtures refer to fixtures that have been standardized and serialized and can be used to process workpieces of the same type but of different sizes. For mechanical fixtures that manufacture screws of different sizes, the flatness of the screw holes is extremely important. Insufficient flatness of the holes may cause damage to the workpiece, reduce processing accuracy, increase equipment difficulty, and affect the appearance of the product. Therefore, testing the surface flatness of mechanical production fixtures plays an important role in ensuring fixture quality, improving production efficiency, ensuring safety, improving product quality, and extending equipment life. Therefore, in mechanical production, it is very necessary to test the surface flatness of the fixture.

[0003] For a fixture, the most important thing is to detect the condition of its hole area. Unevenness in other places will not affect its use. The existing detection of fixtures based on computer vision is easily disturbed by the flatness features of non-hole areas, which can easily cause errors in the detection results and misjudge the surface flatness of fixtures used in mechanical production, increasing production costs and affecting production quality. Summary of the invention

[0004] In order to solve the technical problems of high cost and low efficiency of manual detection of the surface flatness of mechanical production fixtures and inaccurate detection based on existing computer vision, the purpose of the present invention is to provide a method for detecting the surface flatness of mechanical production fixtures. The technical scheme adopted is as follows:

[0005] Acquire a fixture surface image of a mechanical production fixture, perform edge detection on the fixture surface image, and convert it into a Hough space;

[0006] According to the number of curves corresponding to the curve intersections in the Hough space, combined with the distribution characteristics of the intersections of the curves in the surface image of the fixture and the grid intersections of the preset coordinate grid, and the distribution characteristics of the edge pixels, the initial flatness corresponding to each curve intersection in the Hough space is obtained;

[0007] Obtain the centroid coordinates of the area formed by the outermost edge pixel points of the fixture surface image; obtain the target symmetrical hole possibility corresponding to each curve intersection according to the difference characteristics between the circle center coordinates corresponding to each curve intersection and the centroid coordinates, combined with the radius characteristics of the circle corresponding to each curve intersection and the initial flatness; adjust the Hough space according to the target symmetrical hole possibility, analyze the distribution characteristics of each curve intersection, and obtain the final flatness corresponding to each curve intersection in combination with the initial flatness of each curve intersection;

[0008] The surface flatness of the fixture used in mechanical production is tested according to the final flatness corresponding to all curve intersections.

[0009] Furthermore, the method for obtaining the initial flatness includes:

[0010] The number of curves corresponding to the intersection points of the curves in the Hough space is taken as a curve number parameter;

[0011] When the curve quantity parameter of the curve intersection is less than a preset curve quantity threshold, setting the initial flatness of the corresponding curve intersection to zero;

[0012] When the curve quantity parameter of the curve intersection is greater than or equal to a preset curve quantity threshold, obtaining a grid intersection of a circle corresponding to the curve intersection and a preset coordinate grid; and obtaining a smoothing parameter of the curve intersection according to a distance feature between the grid intersection corresponding to the curve intersection and the nearest edge pixel point;

[0013] The initial flatness of the curve intersection is obtained according to the smoothing parameter of the curve intersection and the curve quantity parameter; the initial flatness of the curve intersection is positively correlated with the curve quantity parameter, and the initial flatness of the curve intersection is negatively correlated with the smoothing parameter.

[0014] Furthermore, the method for obtaining the smoothing parameter includes:

[0015] When the curve quantity parameter of the curve intersection is greater than or equal to a preset curve quantity threshold, the average of the Euclidean distances between all grid intersections corresponding to the curve intersection and the nearest edge pixel point is used as a smoothing parameter of the curve intersection.

[0016] Furthermore, the method for obtaining the initial flatness includes:

[0017] When the curve quantity parameter of the curve intersection is greater than or equal to a preset curve quantity threshold, the smoothing parameter of the curve intersection is negatively correlated mapped and normalized, and then multiplied by the curve quantity parameter, and the product is used as the initial flatness of the corresponding curve intersection.

[0018] Furthermore, the method for obtaining the possibility of the target symmetrical hole includes:

[0019] Obtaining a first possibility parameter according to the difference characteristics between the center coordinates corresponding to each curve intersection point and the center of mass coordinates;

[0020] The radius length of the circle corresponding to each curve intersection point is used as the second possible parameter;

[0021] According to the first possibility parameter, the second possibility parameter and the initial flatness of each curve intersection, the target symmetrical hole possibility corresponding to each curve intersection is obtained; the initial flatness and the second possibility parameter are both positively correlated with the target symmetrical hole possibility; the first possibility parameter is negatively correlated with the target symmetrical hole possibility.

[0022] Furthermore, the method for obtaining the first possibility parameter includes:

[0023] The Euclidean distance between the center coordinates corresponding to each curve intersection point and the center of mass coordinates is used as the first possibility parameter.

[0024] Furthermore, the method for obtaining the final flatness includes:

[0025] The Hough space is adjusted by taking the curve intersection corresponding to the maximum value of the target symmetric hole possibility as the coordinate origin of the Hough space; in the adjusted Hough space, according to the distance characteristics from each curve intersection to the symmetry axis, the symmetry possibility that the center of the circle corresponding to each curve intersection is on the symmetry axis is obtained;

[0026] When the symmetry possibility of the curve intersection is greater than or equal to a preset symmetry possibility threshold, the initial flatness of the curve intersection is normalized as the final flatness corresponding to the curve intersection; the preset symmetry possibility threshold is a positive number;

[0027] When the symmetry possibility of the curve intersection is less than a preset symmetry possibility threshold, marking the curve intersection as a curve intersection to be analyzed;

[0028] The intersection point of the curve to be analyzed and any other intersection point of the curve to be analyzed constitute a target intersection point group; analyze the distribution characteristics of the two intersection points of the curve to be analyzed in each target intersection point group relative to the symmetry axis, and obtain the first symmetry parameter of each target intersection point group; negatively correlate and normalize the absolute value of the difference between the radii of the two circles corresponding to each target intersection point group, and obtain the second symmetry parameter of each target intersection point group; select the minimum value of the two initial flatnesses corresponding to each target intersection point group as the flatness reference value; and use the product of the second symmetry parameter and the flatness reference value corresponding to each target intersection point group as the symmetry degree parameter;

[0029] The target intersection point group corresponding to the maximum value of all symmetry degree parameters corresponding to each intersection point of the curve to be analyzed is screened out as the symmetric intersection point group of each intersection point of the curve to be analyzed, and the product of the symmetry degree parameters of the symmetric intersection point group and the corresponding flatness reference value is normalized as the final flatness corresponding to each intersection point of the curve to be analyzed.

[0030] Furthermore, the method for obtaining the symmetry possibility includes:

[0031] The distance from each curve intersection to the symmetry axis is normalized and mapped using a natural logarithmic function. The absolute value of the mapped value is taken as the symmetry possibility of each curve intersection.

[0032] Furthermore, the calculation formula of the first symmetry parameter includes:

[0033] ;in, and represents the sequence number of the intersection point of the curve to be analyzed, and ; Indicates The intersection point of the curve to be analyzed and The first symmetry parameter of the target intersection point group formed by the intersection points of the curves to be analyzed; Represents the maximum and minimum normalized function; Indicates taking the absolute value; Indicates The horizontal coordinates of the intersection points of the curves to be analyzed; Indicates The ordinate of the intersection point of the curve to be analyzed; Indicates The horizontal coordinates of the intersection points of the curves to be analyzed; Indicates The ordinate of the intersection point of the curve to be analyzed; Indicates the preset division by zero constant; Indicates The intersection point of the curve to be analyzed and The symmetry relationship parameters corresponding to the intersection points of the curves to be analyzed, , Indicates Iverson brackets.

[0034] Furthermore, the method for detecting the surface flatness of a mechanical production fixture according to the final flatness corresponding to all curve intersections includes:

[0035] The final flatness with the largest preset hole quantity parameter is selected, and the sum of the selected final flatnesses is used as the surface flatness of the mechanical production fixture; when the surface flatness of the mechanical production fixture is lower than the preset flatness safety threshold, the fixture surface flatness is considered abnormal.

[0036] The present invention has the following beneficial effects:

[0037] The present invention first obtains a fixture surface image to provide a basis for the detection of the surface flatness of the fixture for mechanical production; further edge detection is performed on the fixture surface image and converted into the Hough space to facilitate the subsequent analysis of the distribution characteristics of holes on the fixture surface; further, according to the curve quantity characteristics corresponding to the curve intersections in the Hough space, combined with the distribution characteristics of the grid intersections of the circle corresponding to the curve intersections and the preset coordinate grid, and the distribution characteristics of the edge pixel points, the initial flatness corresponding to each curve intersection in the Hough space is obtained, and the flatness is preliminarily evaluated from the fitting feature angle of the edge pixel points of the holes on the surface of the mechanical production fixture and the circle, so as to obtain a more accurate final flatness in the subsequent Preparation; further adjust the Hough space so that the coordinates of the curve intersections in the Hough space can better reflect the distribution characteristics of the holes, so as to obtain a more accurate final flatness and improve the accuracy of the surface flatness detection results of the mechanical production fixture; further in the adjusted Hough space, analyze the distribution characteristics of each curve intersection, and evaluate the flatness of the holes in combination with the symmetrical distribution characteristic angle, and combine the initial flatness of each curve intersection to obtain the final flatness corresponding to each curve intersection, so as to provide a basis for the final evaluation of the overall flatness of the fixture surface; finally, according to the final flatness corresponding to all curve intersections, the surface flatness of the mechanical production fixture is detected. The present invention is aimed at mechanical production fixtures with symmetrical characteristics, and uses the Hough space to analyze the fitting characteristics of the edge pixel points of the holes on the surface of the mechanical production fixture and the circle, and combines the symmetrical characteristics of the holes reflected by the distribution of the curve intersections to detect the flatness of the fixture surface and ensure production quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 A flow chart of a method for detecting surface flatness of a fixture for mechanical production provided by one embodiment of the present invention;

[0040] Figure 2 A schematic diagram of a mechanical production fixture provided by an embodiment of the present invention;

[0041] Figure 3 A schematic diagram of camera installation for capturing images of a fixture for mechanical production provided by an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of a grid intersection provided by an embodiment of the present invention;

[0043] Figure 5 A schematic diagram of the largest hole marking on the surface of a fixture for mechanical production provided by one embodiment of the present invention;

[0044] Figure 6 A flowchart of a method for obtaining final flatness provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the surface flatness detection method of a mechanical production fixture proposed by the present invention, its specific implementation method, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0046] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0047] The specific scheme of the method for detecting the surface flatness of a fixture for mechanical production provided by the present invention is described in detail below with reference to the accompanying drawings.

[0048] See also Figure 2 , which shows a schematic diagram of a mechanical production fixture provided by an embodiment of the present invention, in which there are multiple circular holes, and some of the holes are distributed on the vertical symmetry axis where the center of the largest hole is located, and some of the holes are symmetrical about the vertical symmetry axis; the present invention is based on the Hough circle transformation, and takes into account that when the fixture holes have flatness defects such as burrs or deformations, the symmetrical distribution characteristics of the holes will be affected, and the distribution characteristics of the intersection points of the curves in the Hough space will be affected, so as to analyze the surface flatness of the mechanical production fixture.

[0049] See also Figure 1 , which shows a flow chart of a method for detecting surface flatness of a fixture for mechanical production provided by an embodiment of the present invention, specifically comprising:

[0050] Step S1: Acquire a fixture surface image, perform edge detection on the fixture surface image, and convert it into a Hough space.

[0051] In the embodiment of the present invention, firstly, a surface image of the fixture is acquired to provide a basis for the surface flatness detection of the fixture for mechanical production.

[0052] See also Figure 3 , Figure 3 A schematic diagram of camera installation for capturing a fixture for mechanical production provided by an embodiment of the present invention is shown. Figure 3The square frame is parallel to the fixture surface, and the arrow is the vertical line between the fixture surface and the square frame. Figure 3 As shown in the box, it is placed parallel to the front of the fixture to collect the surface image of the fixture.

[0053] In an embodiment of the present invention, considering that edge pixels usually represent the main features in an image, which are the boundaries of objects or the boundaries between regions, edge detection can reduce the number of pixels that need to be processed in the Hough transform, filter out some irrelevant image features, and make the Hough transform more focused on detecting the hole features on the fixture surface, thereby improving the speed and efficiency of the algorithm. Therefore, edge detection is performed on the fixture surface image and converted into the Hough space.

[0054] It should be noted that, in one embodiment of the present invention, the algorithm used for edge detection of the fixture surface image is the Canny edge detection algorithm, and the Hough circle transform is used when converting to the Hough space. In other embodiments of the present invention, the implementer may also use other edge detection methods such as the Sobel operator for edge detection, which are technical means well known to those skilled in the art and will not be elaborated here.

[0055] It should be noted that, in one embodiment of the present invention, the x-axis of the Hough space represents the abscissa of the center of the circle, the y-axis represents the ordinate of the center of the circle, and the z-axis represents the radius of the circle.

[0056] Step S2: According to the number of curves corresponding to the curve intersections in the Hough space, the distribution characteristics of the grid intersections of the circles corresponding to the curve intersections and the preset coordinate grid, and the distribution characteristics of the edge pixels, the initial flatness corresponding to each curve intersection in the Hough space is obtained.

[0057] In the embodiment of the present invention, considering that each edge pixel point corresponds to a curve in the Hough space, there are intersections between the curves, and the number of curves corresponding to the curve intersections represents the possibility that the curve intersections correspond to circles, that is, the possibility that the curve intersections correspond to holes, so it is necessary to analyze the number characteristics of the curves corresponding to the curve intersections in the Hough space; considering the difference between the circle corresponding to the curve intersection and the circle or approximate circle formed by the edge pixels, it can reflect the flatness of the area formed by the edge pixels, and comparing the entire circle corresponding to the curve intersection, the amount of calculation is large, and at the same time, the circle corresponding to the curve intersection also has the possibility of not corresponding to the hole on the fixture surface, so some grid intersections are screened out through a preset coordinate grid, and the distribution characteristics of the grid intersections and the edge pixels are analyzed to obtain the initial flatness corresponding to each curve intersection in the Hough space.

[0058] Preferably, in one embodiment of the present invention, considering that when the number of curves corresponding to the curve intersections in the Hough space is too small, the possibility that the curve intersections correspond to circles is small, the possibility that they correspond to holes is smaller, and the reference for obtaining the surface flatness characteristics of the fixture is too weak, so the number of curves corresponding to the curve intersections in the Hough space is used as the curve number parameter; when the curve number parameter of the curve intersection is less than the preset curve number threshold, the initial flatness of the corresponding curve intersection is set to zero;

[0059] Considering that when the number of curves corresponding to the intersection of the curves exceeds the threshold of the number of curves, it may correspond to a circle surrounded by some edge pixels of a hole. The more curves there are, the greater the possibility of corresponding holes, and the stronger the reference for obtaining the surface flatness characteristics of the fixture. Therefore, the initial flatness of the intersection of the curves is positively correlated with the curve number parameter; at the same time, the closer the distance between the grid intersection corresponding to the intersection of the curves and the nearest edge pixel point is, the more the edge pixel point conforms to the circular feature and the smoother the hole is, so the initial flatness of the intersection of the curves is negatively correlated with the smoothing parameter;

[0060] Based on this, when the curve number parameter of the curve intersection is greater than or equal to the preset curve number threshold, the grid intersection of the circle corresponding to the curve intersection and the preset coordinate grid is obtained; according to the distance characteristics between the grid intersection corresponding to the curve intersection and the nearest edge pixel point, the smoothing parameter of the curve intersection is obtained;

[0061] The initial smoothness of the curve intersection is obtained according to the smoothing parameter of the curve intersection and the curve quantity parameter.

[0062] Preferably, in one embodiment of the present invention, considering that Euclidean distance is a commonly used distance measurement method, when the curve number parameter of the curve intersection is greater than or equal to a preset curve number threshold, the average Euclidean distance between all grid intersections corresponding to the curve intersection and the nearest edge pixel point is used as the smoothing parameter of the curve intersection.

[0063] ;

[0064] in, Indicates the sequence number of the curve intersection in Hough space; Indicates The smoothing parameters corresponding to the intersection points of the curves; Indicates The number of grid intersections corresponding to each curve intersection; Indicates the sequence number of the grid intersection point corresponding to the curve intersection point; Indicates The intersection point of the curves corresponds to the The Euclidean distance between the grid intersection and the nearest edge pixel.

[0065] In other embodiments of the present invention, the implementer may also adopt other distance measurement methods such as Manhattan distance to obtain smoothing parameters, which and Euclidean distance are technical means well known to those skilled in the art and will not be described in detail here.

[0066] Preferably, in one embodiment of the present invention, when the curve quantity parameter of the curve intersection is greater than or equal to a preset curve quantity threshold, the smoothing parameter of the curve intersection is negatively correlated mapped and normalized, and then multiplied by the curve quantity parameter, and the product is used as the initial flatness of the corresponding curve intersection.

[0067] The calculation formula for initial flatness includes:

[0068] ;

[0069] in, Indicates the sequence number of the curve intersection in Hough space; Indicates The initial flatness corresponding to the intersection of the curves; Indicates The number of curves corresponding to the intersection points of the curves; Indicates The smoothing parameters corresponding to the intersection points of the curves; Indicates the preset curve quantity threshold; Expressed as a natural constant The exponential function of base .

[0070] In the calculation formula of initial flatness, when When , it is considered that the number of curves corresponding to the intersection of the curves is too small, the possibility of holes in the corresponding fixture surface image is small, or the holes are deformed too much, the edge pixels that can be surrounded by a circle are small, and the flatness is too low, and a constant of 0 is assigned as the initial flatness; when When , it is considered that the number of curves corresponding to the intersection of the curves is large. The larger it is, the more curves there are, the more corresponding edge pixels there are, the more likely it is that it corresponds to holes in the fixture surface image, and the more obvious the circular features of the holes are, and the greater the initial flatness is; The smaller it is, the closer the distance between the grid intersection and the nearest edge pixel is, which means that the circle formed by the edge pixels fits the circle corresponding to the curve intersection more closely, the smoother the hole is, the higher the hole flatness is, and the greater the initial flatness is.

[0071] In one embodiment of the present invention, In other embodiments of the present invention, other Other basic mathematical operations or function mappings may also be used to implement relevant mappings, which are well known to those skilled in the art and will not be described in detail here.

[0072] Among them, a positive correlation means that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the power of an exponential function, which is determined by actual application; a negative correlation means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtraction relationship, a division relationship, etc., which is determined by actual application.

[0073] See also Figure 4 , Figure 4 A schematic diagram of a grid intersection provided by an embodiment of the present invention; Figure 4 The coordinate grid is composed of several straight lines, the distance between the straight lines is the same, and the horizontal and vertical intersections form a coordinate grid. It also contains a circle, and there are several intersections between the circle and the straight lines, which are marked in the figure. Such punctuation points are grid intersections. In one embodiment of the present invention, the distance between parallel straight lines is 5 pixels. Figure 4 The minimum square size in is In other embodiments of the present invention, implementers can set other spacings on their own.

[0074] It should be noted that in another embodiment of the present invention, when computing resources are sufficient, the grid intersections are not screened through the coordinate grid, and the points on the circle corresponding to the curve intersections are selected in an equidistant manner, and the nearest edge pixel points are analyzed. For example, 360 points are selected equidistantly on the circle to evaluate the fit between the shape of the closed area formed by the edge pixel points of the holes on the surface of the fixture and the circle to obtain the initial flatness.

[0075] Step S3: Obtain the centroid coordinates of the area formed by the outermost edge pixel points of the fixture surface image; obtain the possibility of the target symmetrical hole corresponding to each curve intersection based on the difference characteristics between the center coordinates of the circle corresponding to each curve intersection and the centroid coordinates, combined with the radius characteristics of the circle corresponding to each curve intersection and the initial flatness; adjust the Hough space according to the possibility of the target symmetrical hole, analyze the distribution characteristics of each curve intersection, and obtain the final flatness corresponding to each curve intersection based on the initial flatness of each curve intersection.

[0076] In the embodiment of the present invention, in order to analyze the surface flatness of the fixture by using the symmetrical distribution characteristics of the holes on the fixture surface, it is necessary to adjust the Hough space so that the coordinates of the intersection points of the curves in the Hough space can better reflect the distribution characteristics of the holes, thereby obtaining a more accurate final flatness and improving the accuracy of the surface flatness detection results of the fixture for mechanical production; and the surface holes of the fixture in the embodiment of the present invention are symmetrical about the vertical line of the center of the largest hole, or distributed on this vertical line, so it is necessary to adjust the Hough space to make full use of this feature; please refer to Figure 5, which shows a schematic diagram of the maximum hole marking on the surface of a mechanical production fixture provided by an embodiment of the present invention. It can be seen from the figure that from the camera perspective, the fixture surface is a 50cm*50cm square, and the area formed by the outermost edge pixel points of the fixture surface image is a square. The center of the circle of the largest hole is the center of mass of the square, so the center of mass coordinates of the area formed by the outermost edge pixel points of the fixture surface image are obtained to facilitate the subsequent adjustment of the Hough space.

[0077] Considering that the closer the circle corresponding to the intersection of the curves is to the centroid coordinates and the larger the radius is, the more likely the intersection of the curves is to be the largest hole, that is, the target symmetrical hole. The initial flatness represents the reference of the hole corresponding to the intersection of the curves. Therefore, according to the difference characteristics between the center coordinates of the circle corresponding to each intersection of the curves and the center coordinates of the target symmetrical hole, combined with the radius characteristics of the circle corresponding to each intersection of the curves and the initial flatness, the possibility of the target symmetrical hole corresponding to each intersection of the curves is obtained, providing a basis for adjusting the Hough space.

[0078] Preferably, in one embodiment of the present invention, considering that the greater the difference between the center coordinates of the circle corresponding to the intersection of the curves and the center coordinates of the mass, the less likely the circle corresponding to the intersection of the curves is to correspond to the target symmetrical hole, the first possibility parameter is obtained according to the difference characteristics between the center coordinates of the circle corresponding to each intersection of the curves and the center coordinates of the target symmetrical hole, and the possibility of the target symmetrical hole is negatively correlated with the first possibility parameter;

[0079] Considering that the larger the radius of the circle corresponding to each curve intersection is, the more likely the circle corresponding to the curve intersection is the target symmetrical hole, the radius of the circle corresponding to each curve intersection is used as the second possibility parameter, and the second possibility parameter is positively correlated with the possibility of the target symmetrical hole;

[0080] Considering that the initial flatness represents the reference of the corresponding hole of the curve intersection, the larger the initial flatness, the more likely it is to correspond to the hole and the stronger the reference, so the possibility of the target symmetrical hole is positively correlated with the initial flatness;

[0081] According to the first possibility parameter, the second possibility parameter and the initial flatness of each curve intersection, the target symmetrical hole possibility corresponding to each curve intersection is obtained.

[0082] In one embodiment of the present invention, the calculation formula of the target symmetric hole probability includes:

[0083] ;

[0084] in, Indicates the sequence number of the curve intersection in Hough space; Indicates The probability of the target symmetrical hole corresponding to the intersection of the curves; Indicates The initial flatness corresponding to the intersection of the curves; Indicates The first possibility parameter corresponding to the intersection of the curves; Indicates The second possibility parameter corresponding to the intersection of the curves; represents a preset zero division parameter. In one embodiment of the present invention, .

[0085] Preferably, in one embodiment of the present invention, considering that the Euclidean distance is a commonly used distance measurement method, the Euclidean distance between the center coordinates and the centroid coordinates corresponding to each curve intersection point is used as the first possibility parameter.

[0086] In other embodiments of the present invention, the implementer may also adopt other distance measurement methods such as Manhattan distance to obtain the first possibility parameter. Both Manhattan distance and Euclidean distance are technical means well known to those skilled in the art and will not be described in detail here.

[0087] In an embodiment of the present invention, after obtaining the target symmetric hole probability of all curve intersections, the Hough space can be adjusted according to the target symmetric hole probability, the distribution characteristics of each curve intersection are analyzed, the symmetry characteristics of the circle corresponding to the curve intersection are analyzed, and the initial flatness of each curve intersection is combined to obtain a more accurate final flatness of each curve intersection.

[0088] Preferably, in one embodiment of the present invention, the method for obtaining the final flatness includes:

[0089] See also Figure 6 , which shows a flow chart of a method for obtaining final flatness provided by an embodiment of the present invention.

[0090] Step S101: The Hough space is adjusted by taking the curve intersection corresponding to the maximum probability of the target symmetrical hole as the coordinate origin of the Hough space; in the adjusted Hough space, according to the distance characteristics from each curve intersection to the symmetry axis, the symmetry probability that the center of the circle corresponding to each curve intersection is on the symmetry axis is obtained.

[0091] Taking into account that some holes are distributed on the vertical symmetry axis where the center of the largest hole is located, and some holes are symmetrical about the vertical symmetry axis, the curve intersections in the adjusted Hough space have the same distribution characteristics. However, when analyzing the curve intersections distributed on the symmetry axis and the curve intersections not on the symmetry axis, different analysis methods need to be adopted due to their different distribution characteristics. Therefore, it is necessary to first obtain the symmetry possibility and classify the curve intersections.

[0092] Step S102: when the symmetry possibility of the curve intersection is greater than or equal to a preset symmetry possibility threshold, the initial flatness of the curve intersection is normalized and used as the final flatness corresponding to the curve intersection.

[0093] In the adjusted Hough space, when the symmetry possibility of the curve intersection is greater than or equal to the preset symmetry possibility threshold, the curve intersection is considered to be distributed on the symmetry axis, which satisfies the characteristic that some holes are distributed on the vertical symmetry axis where the center of the largest hole is located. Therefore, the initial flatness of the curve intersection is directly normalized and used as the final flatness corresponding to the curve intersection.

[0094] Step S103: When the symmetry possibility of the curve intersection is less than a preset symmetry possibility threshold, the curve intersection is marked as a curve intersection to be analyzed.

[0095] In the adjusted Hough space, when the curve intersection is not on the symmetry axis, it is necessary to analyze the symmetry of the curve intersection, so the curve intersection is marked as the curve intersection to be analyzed for subsequent analysis.

[0096] Step S104: The intersection of the curve to be analyzed and any other intersection of the curve to be analyzed constitute a target intersection group; analyze the distribution characteristics of the two intersections of the curves to be analyzed in each target intersection group relative to the symmetry axis, and obtain the first symmetry parameter of each target intersection group; negatively correlate and normalize the absolute value of the difference in the radii of the two circles corresponding to each target intersection group to obtain the second symmetry parameter of each target intersection group; select the minimum value of the two initial flatnesses corresponding to each target intersection group as the flatness reference value; and use the product of the second symmetry parameter corresponding to each target intersection group and the flatness reference value as the symmetry degree parameter.

[0097] Due to actual space limitations, the holes on the fixture surface generally appear in pairs when they are symmetrical about the axis of symmetry, so the intersection points of the curves to be analyzed are grouped in pairs to form a target intersection point group; considering that when the holes are symmetrical about the axis of symmetry, the distribution positions of the two holes are symmetrical and the sizes are the same, the distribution characteristics of the two intersection points of the curves to be analyzed relative to the axis of symmetry are analyzed to obtain the first symmetry parameter, and the absolute value of the difference between the radii of the two circles corresponding to the target intersection point group is obtained for negative correlation mapping and normalization as the second symmetry parameter; considering that any low initial flatness of the target intersection point group means that there may be defects in the holes on the fixture surface, affecting the production quality, the minimum value of the two initial flatnesses corresponding to each target intersection point group is selected as the flatness reference value, so as to facilitate the subsequent screening of the symmetrical intersection point groups and obtain the final flatness.

[0098] The calculation formula of the symmetry degree parameter includes:

[0099] ;

[0100] in, and represents the sequence number of the intersection point of the curve to be analyzed, and ; No. The intersection point of the curve to be analyzed and Symmetry degree parameter of the target intersection group composed of the intersection points of the curves to be analyzed; Indicates The intersection point of the curve to be analyzed and The first symmetry parameter of the target intersection point group formed by the intersection points of the curves to be analyzed; Indicates The radius of the circle corresponding to the intersection of the curves to be analyzed; Indicates The radius of the circle corresponding to the intersection of the curves to be analyzed; Expressed as a natural constant The exponential function with base ; Indicates The intersection point of the curve to be analyzed and The second symmetry parameter of the target intersection point group composed of the intersection points of the curves to be analyzed.

[0101] It should be noted that in other embodiments of the present invention, other basic mathematical operations or function mappings may also be used to implement relevant mappings, which are technical means well known to those skilled in the art and will not be elaborated herein.

[0102] Step S105: Filter out the target intersection group corresponding to the maximum value of all symmetry degree parameters corresponding to each curve intersection to be analyzed, as the symmetric intersection group for each curve intersection to be analyzed, and normalize the product of the symmetry degree parameters of the symmetric intersection group and the corresponding flatness reference value as the final flatness corresponding to each curve intersection to be analyzed.

[0103] When the symmetry features of the two intersections of the target intersection group are more obvious, the symmetry degree parameter is larger, so the combination with the largest symmetry degree is selected as the symmetric intersection group of the curves to be analyzed. The larger the symmetry degree parameter of the symmetric intersection group, the more obvious the symmetry features of the circles corresponding to the intersections of the two curves to be analyzed, the more obvious the symmetry features of the holes on the surface of the fixture, the less likely defects will occur, and the higher the flatness. Therefore, the product of the symmetry degree parameter of the symmetric intersection group and the corresponding flatness reference value is normalized and used as the final flatness corresponding to each intersection of the curves to be analyzed.

[0104] Preferably, in one embodiment of the present invention, in order to magnify the difference in the distances from different curve intersections to the axis of symmetry, which is more conducive to classifying and analyzing the curve intersections based on the possibility of symmetry, the distance from each curve intersection to the axis of symmetry is normalized and mapped using a natural logarithmic function, and the absolute value of the mapped value is taken as the possibility of symmetry for each curve intersection.

[0105] The calculation formula for the symmetric probability includes:

[0106] ;

[0107] in, Indicates the sequence number of the curve intersection in Hough space; Indicates The symmetry possibilities corresponding to the intersection of the curves; represents the absolute value function; represents the natural logarithm function; represents the maximum and minimum normalized function; Indicates The distance from the intersection of the curves to the symmetry axis in the adjusted Hough space.

[0108] It should be noted that, in one embodiment of the present invention, the preset symmetry possibility threshold is 3; in other embodiments of the present invention, other basic mathematical operations or function mappings can also be used to implement relevant mappings, and other preset symmetry possibility thresholds can be set. These are technical means well known to those skilled in the art and will not be elaborated here.

[0109] Preferably, in one embodiment of the present invention, the symmetry axis is set as the y-axis in the adjusted Hough space, so the abscissas of the two centers of the circles symmetrical about the symmetry axis are symmetrical about the y-axis and have the same ordinates, so the calculation formula of the first symmetry parameter includes:

[0110] ;

[0111] in, and represents the sequence number of the intersection point of the curve to be analyzed, and ; Indicates The intersection point of the curve to be analyzed and The first symmetry parameter of the target intersection point group formed by the intersection points of the curves to be analyzed; represents the maximum and minimum normalized function; Indicates taking the absolute value; Indicates The horizontal coordinates of the intersection points of the curves to be analyzed; Indicates The ordinate of the intersection point of the curve to be analyzed; Indicates The horizontal coordinates of the intersection points of the curves to be analyzed; Indicates The ordinate of the intersection point of the curve to be analyzed; Indicates the preset division by zero constant; Indicates The intersection point of the curve to be analyzed and The symmetry relationship parameters corresponding to the intersection points of the curves to be analyzed, , Indicates Iverson brackets.

[0112] In the calculation formula of the first symmetry parameter, the two centers of the circles symmetrical about the axis of symmetry must be on both sides of the axis of symmetry, so the Iverson brackets are used for screening. When the conditions in the brackets are met, the value is 1, otherwise it is 0; since the intersection of the curve to be analyzed is not on the y-axis, The smaller it is, the more likely the x-coordinates of the intersection of the two curves to be analyzed are symmetrical about the y-axis or the same, and the more likely the y-coordinates are the same. Eliminate the interference of asymmetric conditions, so The larger the value, the greater the possibility that the intersection of the two curves to be analyzed is symmetrical about the symmetry axis. The symmetry characteristics of the intersection of the curves to be analyzed are measured from the spatial distribution, which is convenient for analyzing the symmetry characteristics of the hole and detecting the flatness of the fixture surface. In one embodiment of the present invention, .

[0113] Step S4: Detect the surface flatness of the mechanical production fixture according to the final flatness corresponding to all the curve intersections.

[0114] After obtaining the final flatness corresponding to all the curve intersections, the surface flatness of the fixture used in mechanical production can be detected according to the final flatness corresponding to all the curve intersections.

[0115] Preferably, in one embodiment of the present invention, please refer to Figure 2 There are 9 holes on the fixture surface, so the preset hole number parameter is set to 9, and the 9 largest final flatnesses are selected. The sum of the selected final flatnesses is used as the surface flatness of the fixture for mechanical production.

[0116] When defects appear in the holes on the surface of the fixture, the number or distribution of pixels at the edge of the hole will change, affecting the symmetrical distribution characteristics of the pixels at the edge of the hole, resulting in a lower degree of fit between the circle corresponding to the intersection of the curves in the Hough space and the pixels at the edge of the hole, and the symmetrical characteristics of the intersection of the curves are affected, resulting in a lower flatness. Finally, it is detected that the surface flatness of the fixture used in mechanical production is low.

[0117] In one embodiment of the present invention, the flatness safety threshold is set to 7. When the surface flatness of the mechanical production fixture is lower than 7, it is considered that the surface flatness of the fixture is abnormal and normal production cannot be guaranteed, and timely maintenance is required.

[0118] In summary, in order to solve the technical problems of high cost and low efficiency of manual detection of the surface flatness of mechanical production fixtures, and inaccurate detection based on existing computer vision, the present invention provides a method for detecting the surface flatness of mechanical production fixtures. The present invention first obtains the fixture surface image, performs edge detection on the fixture surface image and converts it into the Hough space; further obtains the initial flatness corresponding to each curve intersection in the Hough space; further adjusts the Hough space according to the difference characteristics of the center coordinates and the center of mass coordinates corresponding to each curve intersection, combined with the radius characteristics of the circle corresponding to each curve intersection and the initial flatness; further analyzes the distribution characteristics of each curve intersection, and obtains the final flatness corresponding to each curve intersection in combination with the initial flatness of each curve intersection; finally, the surface flatness of the mechanical production fixture is detected according to the final flatness corresponding to all curve intersections. The present invention aims at mechanical production fixtures with symmetrical features. The Hough space is used to analyze the fitting characteristics of edge pixel points of holes on the surface of the mechanical production fixture and the circle. The symmetrical characteristics of the holes reflected by the distribution of curve intersections are combined to detect the flatness of the fixture surface and ensure production quality.

[0119] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0120] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A method for detecting the surface flatness of a fixture for mechanical production, characterized in that: The method comprises: Acquire a fixture surface image of a mechanical production fixture, perform edge detection on the fixture surface image, and convert the image into a Hough space; Obtaining the initial flatness corresponding to each curve intersection in the Hough space based on the number of curves corresponding to the curve intersection in the Hough space, combined with the distribution characteristics of the intersections of the circle of the curve intersection in the fixture surface image and the grid intersection of the preset coordinate grid, and the distribution characteristics of the edge pixels; Obtaining the centroid coordinates of the area formed by the outermost edge pixel points of the fixture surface image; obtaining the target symmetrical hole probability corresponding to each curve intersection based on the difference characteristics between the circle center coordinates corresponding to each curve intersection and the centroid coordinates, combined with the radius characteristics of the circle corresponding to each curve intersection and the initial flatness; adjusting the Hough space based on the target symmetrical hole probability, analyzing the distribution characteristics of each curve intersection, and obtaining the final flatness corresponding to each curve intersection based on the initial flatness of each curve intersection; The surface flatness of the fixture used in mechanical production is tested based on the final flatness corresponding to all curve intersections; The method for obtaining the initial flatness includes: The number of curves corresponding to the curve intersection points in the Hough space is used as a curve number parameter; When the curve number parameter of the curve intersection is less than a preset curve number threshold, setting the initial flatness of the corresponding curve intersection to zero; When the curve number parameter of the curve intersection is greater than or equal to a preset curve number threshold, obtaining a grid intersection of a circle corresponding to the curve intersection and a preset coordinate grid; and obtaining a smoothing parameter of the curve intersection based on a distance feature between the grid intersection corresponding to the curve intersection and the nearest edge pixel point. The initial flatness of the curve intersection is obtained according to the smoothing parameter of the curve intersection and the curve quantity parameter; the initial flatness of the curve intersection is positively correlated with the curve quantity parameter, and the initial flatness of the curve intersection is negatively correlated with the smoothing parameter; the method for obtaining the smoothing parameter includes: When the curve number parameter of the curve intersection is greater than or equal to a preset curve number threshold, the mean of the Euclidean distances between all grid intersections corresponding to the curve intersection and the nearest edge pixel point is used as a smoothing parameter of the curve intersection; The method for obtaining the initial flatness includes: When the curve quantity parameter of the curve intersection is greater than or equal to a preset curve quantity threshold, negatively correlating and normalizing the smoothing parameter of the curve intersection, multiplying the result by the curve quantity parameter, and using the product as the initial flatness of the corresponding curve intersection; The method for obtaining the possibility of the target symmetrical hole includes: Obtaining a first possibility parameter based on difference characteristics between the center coordinates corresponding to each curve intersection point and the center of mass coordinates; The radius length of the circle corresponding to each curve intersection point is used as the second possibility parameter; Obtaining a target symmetrical hole probability corresponding to each curve intersection point based on the first probability parameter, the second probability parameter, and the initial flatness of each curve intersection point; the initial flatness and the second probability parameter are both positively correlated with the target symmetrical hole probability; and the first probability parameter is negatively correlated with the target symmetrical hole probability; The method for obtaining the first possibility parameter includes: The Euclidean distance between the center coordinates of each curve intersection point and the center coordinates is used as a first possibility parameter; The method for obtaining the final flatness includes: The Hough space is adjusted by using the curve intersection corresponding to the maximum probability of the target symmetric hole as the coordinate origin of the Hough space; in the adjusted Hough space, the symmetric probability that the center of the circle corresponding to each curve intersection is on the symmetry axis is obtained based on the distance characteristics from each curve intersection to the symmetry axis; When the symmetry probability of the curve intersection is greater than or equal to a preset symmetry probability threshold, the initial flatness of the curve intersection is normalized and used as the final flatness corresponding to the curve intersection; the preset symmetry probability threshold is a positive number; When the symmetry probability of the curve intersection is less than a preset symmetry probability threshold, marking the curve intersection as a curve intersection to be analyzed; The intersection point of the curve to be analyzed and any other intersection point of the curve to be analyzed constitute a target intersection point group; analyze the distribution characteristics of the two intersection points of the curve to be analyzed in each target intersection point group relative to the symmetry axis to obtain a first symmetry parameter of each target intersection point group; perform negative correlation mapping and normalization on the absolute value of the difference between the radii of the two circles corresponding to each target intersection point group to obtain a second symmetry parameter of each target intersection point group; select the minimum value of the two initial flatness values ​​corresponding to each target intersection point group as a flatness reference value; and use the product of the second symmetry parameter and the flatness reference value corresponding to each target intersection point group as a symmetry degree parameter; The target intersection point group corresponding to the maximum value among all symmetry degree parameters corresponding to each intersection point of the curve to be analyzed is screened out as the symmetric intersection point group of each intersection point of the curve to be analyzed, and the product of the symmetry degree parameter of the symmetric intersection point group and the corresponding flatness reference value is normalized to obtain the final flatness corresponding to each intersection point of the curve to be analyzed; the method for obtaining the symmetry possibility includes: The distance from each curve intersection to the symmetry axis is normalized and mapped using the natural logarithm function. The absolute value of the mapped value is taken as the symmetry possibility of each curve intersection; The calculation formula of the first symmetry parameter includes: ;in, and represents the sequence number of the intersection of the curve to be analyzed, and ; Indicates the The intersection of the curve to be analyzed and the The first symmetry parameter of the target intersection point group composed of the intersection points of the curves to be analyzed; represents the maximum and minimum normalization function; Indicates taking the absolute value; Indicates the The horizontal coordinates of the intersection points of the curves to be analyzed; Indicates the The vertical coordinates of the intersection points of the curves to be analyzed; Indicates the The horizontal coordinates of the intersection points of the curves to be analyzed; Indicates the The vertical coordinates of the intersection points of the curves to be analyzed; Indicates the preset zero division constant; Indicates the The intersection of the curve to be analyzed and the The symmetry relationship parameters corresponding to the intersection points of the curves to be analyzed, , Indicates Iverson brackets; The method for detecting the surface flatness of a fixture for mechanical production according to the final flatness corresponding to all curve intersections includes: The final flatness with the largest preset hole number parameter is selected, and the sum of the selected final flatnesses is used as the surface flatness of the mechanical production fixture; when the surface flatness of the mechanical production fixture is lower than the preset flatness safety threshold, the fixture surface flatness is considered abnormal.