A method and system for measuring surface flatness of metal products

By constructing the height matrix and calculating the weighted area and roughness of the scratched area, the height data is optimized, and the problem of ignoring the impact of fine scratches in the prior art is solved, and the accuracy and accuracy of the measurement of surface flatness of the annular metal gasket is improved.

CN118654608BActive Publication Date: 2024-11-05WUXI KELIDA ELECTROMECHANIC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411154698.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-11-05
Estimated Expiration
2044-08-22

AI Technical Summary

Technical Problem

When measuring the flatness of the surface of the annular metal gasket, the prior art ignores the influence of fine scratches different from the reference line direction on the flatness, resulting in high measurement errors and it is difficult to accurately reflect the overall flatness of the metal gasket.

Method used

By collecting the height data of the metal gasket surface, a height matrix is ​​constructed and divided into sub-matrixes, the weighted area and roughness in the scratched area are calculated, and the position and height data distribution of the sub-matrix are combined to optimize the height data, and then Determine the surface flatness of the metal gasket.

Benefits of technology

It improves the accuracy of measuring the surface flatness of metal gaskets, reduces measurement deviations, enhances the analytical ability of fine scratches, and improves measurement accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118654608B_ABST
    Figure CN118654608B_ABST
Patent Text Reader

Abstract

The present application relates to the field of flatness measurement technology, and specifically to a surface flatness measurement method and system for metal products, the method comprising: collecting height data of the surface of a metal gasket, forming a height matrix with all the collected height data; dividing the height matrix into sub-matrices; determining each scratch area in the sub-matrix; obtaining the scratch weighted area of ​​each sub-matrix; optimizing each height data in the scratch area based on the distribution of the height data in each scratch area to obtain each optimized height data; determining the scratch roughness of each sub-matrix in combination with the scratch weighted area, the optimized height data, and the distribution of all height data in the sub-matrix; determining the surface flatness of the metal gasket in combination with the scratch roughness and the position of each sub-matrix. Thus, the accuracy of the surface flatness measurement of the metal gasket is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of flatness measurement, and in particular to a surface flatness measurement method and system for metal products. Background Art

[0002] In industrial manufacturing, annular metal gaskets are one of the important metal gaskets produced. As the main parts of mechanical seals, annular metal gaskets have high strength, corrosion resistance and high temperature resistance. The sealing performance of annular metal gaskets is closely related to their surface flatness. Accurately measuring the surface flatness of annular metal gaskets and screening the quality of gaskets based on this can effectively improve the sealing performance of mechanical equipment.

[0003] At present, the industry usually uses laser profilometers to independently analyze the height data at each reference line on the annular metal gasket to measure the surface flatness of the metal gasket. However, there is insufficient utilization of the height data collected by the laser profilometer, ignoring the problem that the slight scratches in the direction different from the reference line have an impact on the surface flatness of the metal gasket, making it difficult to reflect the overall flatness of the annular metal gasket, resulting in a high error in the measurement of the surface flatness of the annular metal gasket. Summary of the invention

[0004] In order to solve the above technical problems, the purpose of this application is to provide a surface flatness measurement method and system for metal products. The technical solutions adopted are as follows:

[0005] In a first aspect, an embodiment of the present application provides a method for measuring the surface flatness of a metal product, the method comprising the following steps:

[0006] Collect height data of the metal gasket surface, take all height data along the same diameter direction of the metal gasket as a group, and construct a height matrix based on each group of height data;

[0007] Divide the height matrix into sub-matrices; calculate the mean of all height data in the sub-matrix, recorded as the first mean; determine each scratch area in the sub-matrix based on the numerical relationship between the height data in the sub-matrix and the first mean, and the distribution of the height data in the sub-matrix; analyze the average level of the height data in the scratch area in each sub-matrix and the number of columns of the sub-matrix in the height matrix, and determine the scratch weighted area of ​​each sub-matrix;

[0008] Calculate the mean of the normalized values ​​of all height data in each scratch area, record it as the second mean, combine the second mean and the height data in the scratch area to obtain each optimized height data; based on the distribution of the difference between all optimized height data in each sub-matrix and the first mean, combined with the scratch weighted area, determine the scratch roughness of each sub-matrix;

[0009] The surface flatness of the metal gasket is determined based on the scratch roughness and the number of columns of each sub-matrix in the height matrix.

[0010] In one embodiment, the construction of the height matrix includes:

[0011] A laser profile measuring instrument is used to scan the metal gasket along the diameter direction. After one scan, a set of height data along the diameter direction is obtained. The metal gasket is scanned once to obtain a preset number of groups of height data along the diameter direction. Each group of height data is used as a row vector of the height matrix.

[0012] In one embodiment, the determination of the scratch area includes:

[0013] The rows and columns where the height data in the sub-matrix are located form the coordinates of the height data, and the coordinates of the height data in the sub-matrix that is less than the first mean value are used by a clustering algorithm to obtain each cluster, and a segmentation threshold of the number of height data in all clusters is obtained, and the corresponding area in the metal gasket of the clusters whose number is greater than the segmentation threshold is taken as the scratch area.

[0014] In one embodiment, the process of determining the scratch weighted area is:

[0015] The product of the number of height data in each scratch area in the submatrix and the number of columns of the submatrix in the height matrix is ​​calculated, and the ratio of the product to the average value of the normalized values ​​of all height data in the corresponding scratch area is calculated. The scratch weighted area is the fusion result of the ratios of all scratch areas in the submatrix.

[0016] In one embodiment, the optimized height data is the product of each height data in the scratch area and the second mean value.

[0017] In one embodiment, the determination of the scratch roughness includes:

[0018] The height data in the non-scratch area of ​​the sub-matrix is ​​recorded as the optimized height data, the mean of the difference between all the optimized height data in each sub-matrix and the first mean is calculated and recorded as the third mean, and the scratch roughness of each sub-matrix is ​​obtained by combining the third mean and the scratch weighted area.

[0019] In one embodiment, the scratch roughness is the product of the third average value and the scratch weighted area.

[0020] In one embodiment, determining the surface flatness of the metal gasket includes:

[0021] The inverse of the product of the scratch roughness of each submatrix and its column number in the height matrix is ​​calculated, and the inverse is used as the exponent of an exponential function with a natural constant as the base. The fusion value of the calculation results of the exponential function of all submatrices in the height matrix is ​​used as the surface flatness.

[0022] In one of the embodiments, the surface flatness of a preset number of normal metal gaskets is calculated, and the maximum value thereof is taken as the flatness threshold. If the measured surface flatness of the metal gasket is greater than or equal to the flatness threshold, the measured surface flatness of the metal gasket is determined to be abnormal; otherwise, the measured surface flatness of the metal gasket is determined to be normal.

[0023] In a second aspect, an embodiment of the present application also provides a surface flatness measurement system for metal products, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of any one of the above-mentioned methods when executing the computer program.

[0024] This application has at least the following beneficial effects:

[0025] The present application collects height data of the surface of the metal gasket, and forms a height matrix with all the collected height data; divides the height matrix into each sub-matrix; determines each scratch area in the sub-matrix based on the distribution of the height data in the sub-matrix; identifies the scratch position in the metal gasket; analyzes the number of height data in the scratch area of ​​each sub-matrix and the distribution of the height data, and determines the weighted scratch area of ​​each sub-matrix in combination with the position of each sub-matrix in the height matrix; the beneficial effect is that by assigning different weights to different scratch areas, the deviation introduced in the height data measurement is corrected, the degree of scratch damage is accurately obtained, and the influence of the measurement deviation on the subsequent calculation of the surface flatness of the annular metal gasket is reduced; based on The distribution of height data in each scratch area is optimized to obtain each optimized height data; the scratch roughness of each sub-matrix is ​​determined by combining the scratch weighted area, the optimized height data, and the distribution of all height data in the sub-matrix; its beneficial effect is that by reducing the optimized height data of the scratch height data, the distinction of the scratch height data in the sub-matrix is ​​improved; thereby improving the accuracy of the surface flatness analysis of the metal gasket; combining the scratch roughness and the position of each sub-matrix in the height matrix to determine the surface flatness of the metal gasket; enhancing the analysis of fine scratches on the surface of the metal gasket and improving the accuracy of the surface flatness measurement of the metal gasket. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1 A flow chart of the steps of a method for measuring the surface flatness of a metal product provided in one embodiment of the present application;

[0028] Figure 2 Construct a flow chart for metal gasket surface flatness. DETAILED DESCRIPTION

[0029] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the following is a detailed description of a surface flatness measurement method and system for metal products proposed in accordance with the present application, its specific implementation, 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.

[0030] 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 application belongs.

[0031] The following is a detailed description of a method and system for measuring the surface flatness of metal products provided by the present application in conjunction with the accompanying drawings.

[0032] See also Figure 1 , which shows a flow chart of a method for measuring the surface flatness of a metal product provided by an embodiment of the present application, the method comprising the following steps:

[0033] S1, collecting height data of the surface of the metal gasket, taking all height data along the same diameter direction of the metal gasket as a group, and constructing a height matrix based on each group of height data.

[0034] In this embodiment, a laser profiler is used to collect height data of the annular metal gasket from the inside to the outside along the diameter direction, that is, the measurement reference line direction of the laser profiler is from the inside to the outside along the diameter direction of the annular metal gasket. After scanning once, L height data are obtained, and the L height data are evenly distributed along the diameter direction; the annular metal gasket is rotated so that the laser profiler scans the annular metal gasket evenly along different diameter directions F times, and then the annular metal gasket rotates one circle; the L height data obtained by scanning once are recorded as a group, and F groups of height data are obtained, wherein, in this embodiment, L=1000, F=1000, and the implementer can set them according to the actual situation, and this application does not limit it here. The laser profiler is a well-known technology for measuring height data, and this embodiment will not be described in detail here.

[0035] A set of height data obtained from a scan is regarded as a row vector, and all row vectors are arranged in the order of scanning to obtain the height matrix obtained by scanning the annular metal gasket. The height matrix can reflect the overall surface height distribution of the measured annular metal gasket, facilitate comprehensive analysis of the relationship between the height data in each diameter direction, and improve the utilization rate of the height data.

[0036] S2, divide the height matrix into each sub-matrix; calculate the mean of all height data in the sub-matrix, recorded as the first mean; determine each scratch area in the sub-matrix based on the numerical relationship between the height data in the sub-matrix and the first mean, and the distribution of the height data in the sub-matrix; combine the number of height data in the scratch area in each sub-matrix and the number of columns of the sub-matrix in the height matrix, analyze the average level of height data in the scratch area, and determine the scratch weighted area of ​​each sub-matrix.

[0037] During the production of annular metal gaskets, defects in processing equipment and improper operation in the process will cause scratches on the surface of the annular metal gasket. Since annular metal gaskets are usually used to seal mechanical equipment, scratches on their surface will not only increase the risk of gasket corrosion and aggravate the deterioration of surface flatness, but also cause its sealing performance to decline, causing equipment leakage.

[0038] Since the directions of scratches on the surface of the annular metal gasket are randomly distributed, when the angle between the scratch direction and the direction of the measurement reference line is too large, a set of height data obtained by measurement will contain less height data of scratches on the gasket surface. At the same time, the width and depth of the fine scratches on the surface of the annular metal gasket are small, which further causes the abnormal height data at the scratches to account for too small a proportion of the height data of a set of height numbers of the measurement reference line, making it difficult to reflect the impact of the scratches on the flatness of the gasket surface, so that the flatness independently calculated by different measurement reference lines cannot accurately represent the overall surface flatness of the annular metal gasket.

[0039] When the laser profilometer scans the annular metal gasket, the height data collected near the inner ring of the gasket is relatively dense, while the height data collected near the outer ring is relatively sparse. In order to distinguish the regional differences caused by the measurement characteristics of the height data of the annular metal gasket and comprehensively analyze the height data of different measurement reference lines, the height matrix is ​​evenly divided into sub-matrices of W1*W2. In this embodiment, W1=W2=100, which can be set by the implementer according to the actual situation, and this embodiment does not limit this.

[0040] The depth of the fine scratches on the surface of the annular metal gasket is relatively shallow, and the height data of the scratched part is slightly different from the height data of the non-scratched part. Therefore, it is difficult to directly distinguish the fine scratches with a shallow depth by the difference in height data alone. Since the scratches on the gasket surface are usually connected, and the height data at the scratches is smaller than the height data in the normal area of ​​the annular metal gasket, the mean of all the height data in each sub-matrix is ​​calculated and recorded as the first mean. The row and column where the height data in the sub-matrix is ​​located constitute the position coordinates of the height data, and the coordinates of the height data in the sub-matrix that is less than the first mean are used as the input of the DBSCAN clustering algorithm. The output of the DBSCAN clustering algorithm is each cluster cluster. The neighborhood radius of the DBSCAN clustering algorithm is set to 3, and the minimum number of cluster samples is set to 5. The implementer can set it according to the actual situation. This embodiment does not limit this. The DBSCAN clustering algorithm is an existing known technology. This embodiment will not be described in detail here. The implementer can choose other clustering algorithms according to the actual situation.

[0041] Since the height data corresponding to the scratch area is relatively concentrated, the number of height data in the clusters corresponding to the scratch area is relatively large. The Otsu threshold method is used to obtain the segmentation threshold of the number of height data in all clusters, and the corresponding area in the metal gasket of the clusters whose number is greater than the segmentation threshold is taken as the scratch area. And the height data in the scratch area is recorded as the scratch height data of the sub-matrix, indicating the height distribution of the scratch. At this point, the scratch area and its scratch height data of each sub-matrix can be obtained. Among them, the Otsu threshold method is an existing well-known technology, and this embodiment will not be described in detail here.

[0042] The position of the submatrix in the height matrix is ​​different, corresponding to different sampling densities of height data on the surface of the annular metal gasket. Near the outer ring of the annular metal gasket, the sampling density of the height data is small, and the compression degree of the scratch area is large, so it is necessary to process the height data in different submatrices differently. In addition, the number of scratch areas in different submatrices and the distribution of height data inside them are different. According to the position of the submatrix and the distribution of height data of its scratch area, the scratch weighted area of ​​each submatrix is ​​calculated, specifically:

[0043] The product of the number of height data in each scratch area in the submatrix and the number of columns of the submatrix in the height matrix is ​​calculated, and the ratio of the product to the average value of the normalized values ​​of all height data in the corresponding scratch area is calculated. The scratch weighted area is the fusion result of the ratios of all scratch areas in the submatrix.

[0044] It should be noted that fusion means combining multiple variables in a manner to enhance the overall effect, which may be specifically addition, multiplication, or a mixture of addition and multiplication, etc.; this embodiment uses addition to perform fusion calculations.

[0045] In this embodiment, the scratch weighted area is calculated as follows:

[0046] ;in, represents the total number of scratch areas in the submatrix at the pth row and qth column of the height matrix; represents the average value of all normalized scratch height data in the kth scratch area in the submatrix at the pth row and qth column of the height matrix; q represents the column number of the submatrix in the height matrix; represents the number of scratch height data in the kth scratch area in the submatrix at the pth row and the qth column of the height matrix; Represents the scratch weighted area of ​​the submatrix at the pth row and qth column of the height matrix.

[0047] The scratch weighted area reflects the severity of the scratch damage of the annular metal gasket at the corresponding sub-matrix. In addition, when there is no scratch area in the sub-matrix, the scratch weighted area of ​​the sub-matrix is ​​set to 1. The implementer can set it according to the actual situation, and this embodiment does not limit it here.

[0048] When the scratch is deeper, the area is larger, and the number of scratches is greater, the average value of the height data in the scratch area of ​​the submatrix is ​​smaller, the number of scratch height data in the scratch area is larger, and the scratch weighted area of ​​the submatrix is ​​larger, indicating that the scratch damage degree of the annular metal gasket in the submatrix is ​​more serious and the surface flatness is worse. When the column index of the submatrix is ​​larger, its corresponding position in the annular metal gasket is closer to the outer ring, and the degree of compression of the actual scratch by the scratch area in the submatrix is ​​greater. At this time, a larger weight is given to it to correct the deviation introduced when measuring the height data, accurately obtain the degree of scratch damage, and reduce the influence of measurement deviation on the surface flatness of the annular metal gasket.

[0049] S3, calculate the mean of the normalized values ​​of all height data in each scratch area, record it as the second mean, combine the second mean and the height data in the scratch area to obtain each optimized height data; based on the distribution of the difference between all optimized height data in each sub-matrix and the first mean, combined with the scratch weighted area, determine the scratch roughness of each sub-matrix.

[0050] Since the depth of fine scratches on the surface of annular metal gaskets is relatively shallow, it is easy to ignore the influence of fine scratches on it when calculating the surface flatness. However, more fine scratches will also cause the surface flatness of the gasket to decrease. In order to enhance the recognition and analysis of fine scratches on the gasket surface, the height data is first calculated and optimized according to the distribution of scratch height data in the sub-matrix.

[0051] For the height data in the non-scratch area of ​​each sub-matrix, the optimized height data is the same as the original height data.

[0052] For the scratch height data in each sub-matrix, the optimized height data is calculated as follows:

[0053] ;in, represents the average value of all normalized scratch height data in the kth scratch area in the submatrix at the pth row and the qth column of the height matrix; recorded as the second mean; Represents the scratch height data of the i-th row and j-th column in the k-th scratch area in the submatrix of the p-th row and q-th column of the height matrix; Represents the optimized height data of the i-th row and j-th column in the k-th scratch area in the sub-matrix of the p-th row and q-th column of the height matrix.

[0054] When the average value of the scratch height data in the scratch area is smaller, the optimized height data is smaller. Since the normalized average value does not exceed 1, the optimized height data of the scratch height data is reduced, while the height data of the normal part remains unchanged, so as to improve the distinction between the scratch height data and the height data of the normal part in the sub-matrix.

[0055] Secondly, according to the distribution of all optimized height data in the sub-matrix, the scratch roughness of each sub-matrix is ​​calculated. In this embodiment, the specific calculation method is:

[0056] ;W1 represents the number of rows of the submatrix, and W2 represents the number of columns of the submatrix; represents the scratch weighted area of ​​the submatrix at the pth row and qth column of the height matrix; Represents the optimized height data of the i-th row and j-th column in the submatrix of the p-th row and q-th column of the height matrix; Represents the average value of all height data in the submatrix at the pth row and qth column of the height matrix; represents the scratch roughness of the submatrix in the pth row and qth column of the height matrix. Recorded as the third mean.

[0057] The scratch roughness of the sub-matrix reflects the flatness of the surface of the annular metal gasket at the sub-matrix. The more serious the scratch damage of the annular metal gasket, the larger the scratch weighted area, the greater the scratch roughness, reflecting the worse the flatness of the surface of the annular metal gasket at the sub-matrix. In addition, when the difference between the optimized height data and the average height data in the sub-matrix is ​​greater, it means that the surface of the annular metal gasket is rougher, the flatness is worse, and the calculated scratch roughness is greater.

[0058] S4, determining the surface flatness of the metal gasket based on the scratch roughness and the number of columns of each sub-matrix in the height matrix.

[0059] Taking into account the change in the sampling density of the height data in the annular metal gasket during measurement, combined with the scratch roughness of the sub-matrix, the surface flatness of the annular metal gasket is calculated. In this embodiment, the specific calculation method is:

[0060] ; Wherein, M represents the number of submatrices contained in each row and column after the height matrix is ​​divided into submatrices; exp() represents an exponential function with a natural constant as the base; q represents the number of columns where the submatrix is ​​located in the height matrix; represents the scratch roughness of the submatrix in the pth row and qth column of the height matrix; Indicates the surface flatness of the annular metal gasket. The metal gasket surface flatness construction flow chart is as follows Figure 2 shown.

[0061] The flatness of the annular metal gasket is negatively correlated with the scratch roughness of the submatrix. The more serious the scratch defect on the surface of the annular metal gasket, the worse its flatness, the greater the scratch roughness of the submatrix, and the smaller the calculated flatness. The greater the sampling density of the height data, the greater the scratch roughness of the gasket part calculated. The larger the number of columns the submatrix is ​​in the height matrix, the closer it is to the outer ring of the annular metal gasket, and the smaller its sampling density. Compared with the inner ring part, its calculated scratch roughness is smaller than the actual roughness, so it is given a greater weight to improve the accuracy of the calculation of the overall surface flatness of the gasket.

[0062] The same calculation method as the above surface flatness is used to calculate the surface flatness of T normal annular metal gaskets. In this embodiment, T is 1000, and the implementer can set it according to the actual situation. This embodiment does not limit this. The maximum value of the above T surface flatnesses is taken as the flatness threshold to screen the annular metal gaskets. If the surface flatness of the measured metal gasket is less than the flatness threshold, the surface flatness of the metal gasket is determined to be normal. If the surface flatness of the measured metal gasket is greater than or equal to the flatness threshold, the surface flatness of the measured metal gasket is determined to be abnormal.

[0063] Based on the same inventive concept as the above method, an embodiment of the present application also provides a surface flatness measurement system for metal products, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the steps of any one of the above-mentioned methods for measuring the surface flatness of metal products are implemented.

[0064] It should be noted that the above sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above is a description of a specific embodiment of this specification. In addition, 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.

[0065] 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.

[0066] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for measuring the surface flatness of a metal product, characterized in that: The method comprises the following steps: Collect height data of the metal gasket surface, take all height data along the same diameter direction of the metal gasket as a group, and construct a height matrix based on each group of height data; Divide the height matrix into sub-matrices; calculate the mean of all height data in the sub-matrix, recorded as the first mean; determine each scratch area in the sub-matrix based on the numerical relationship between the height data in the sub-matrix and the first mean, and the distribution of the height data in the sub-matrix; analyze the average level of the height data in the scratch area in each sub-matrix and the number of columns of the sub-matrix in the height matrix, and determine the scratch weighted area of ​​each sub-matrix; Calculate the mean of the normalized values ​​of all height data in each scratch area, record it as the second mean, combine the second mean and the height data in the scratch area to obtain each optimized height data; based on the distribution of the difference between all optimized height data in each sub-matrix and the first mean, combined with the scratch weighted area, determine the scratch roughness of each sub-matrix; Determine the surface flatness of the metal gasket based on the scratch roughness and the number of columns of each submatrix in the height matrix; The process of determining the scratch weighted area is: The product of the number of height data in each scratch area in the submatrix and the number of columns of the submatrix in the height matrix is ​​calculated, and the ratio of the product to the average value of the normalized values ​​of all height data in the corresponding scratch area is calculated. The scratch weighted area is the fusion result of the ratios of all scratch areas in the submatrix.

2. A method for measuring the surface flatness of a metal product as claimed in claim 1, characterized in that: The construction of the height matrix includes: A laser profile measuring instrument is used to scan the metal gasket along the diameter direction. After one scan, a set of height data along the diameter direction is obtained. The metal gasket is scanned once to obtain a preset number of groups of height data along the diameter direction. Each group of height data is used as a row vector of the height matrix.

3. A method for measuring the surface flatness of a metal product as claimed in claim 1, characterized in that: The determination of the scratch area includes: The rows and columns where the height data in the sub-matrix are located form the coordinates of the height data, and the coordinates of the height data in the sub-matrix that is less than the first mean value are used by a clustering algorithm to obtain each cluster, and a segmentation threshold of the number of height data in all clusters is obtained, and the corresponding area in the metal gasket of the clusters whose number is greater than the segmentation threshold is taken as the scratch area.

4. A method for measuring the surface flatness of a metal product as claimed in claim 1, characterized in that: The optimized height data is the product of each height data in the scratch area and the second mean value.

5. A method for measuring the surface flatness of a metal product as claimed in claim 1, characterized in that: The determination of the scratch roughness includes: The height data in the non-scratch area of ​​the sub-matrix is ​​recorded as the optimized height data, the mean of the difference between all the optimized height data in each sub-matrix and the first mean is calculated and recorded as the third mean, and the scratch roughness of each sub-matrix is ​​obtained by combining the third mean and the scratch weighted area.

6. A method for measuring the surface flatness of a metal product as claimed in claim 5, characterized in that: The scratch roughness is the product of the third average value and the scratch weighted area.

7. A method for measuring the surface flatness of a metal product as claimed in claim 1, characterized in that: Determining the surface flatness of the metal gasket includes: The inverse of the product of the scratch roughness of each submatrix and its column number in the height matrix is ​​calculated, and the inverse is used as the exponent of an exponential function with a natural constant as the base. The fusion value of the calculation results of the exponential function of all submatrices in the height matrix is ​​used as the surface flatness.

8. A method for measuring the surface flatness of a metal product as claimed in claim 7, characterized in that: Calculate the surface flatness of a preset number of normal metal gaskets, and take the maximum value thereof as the flatness threshold. If the measured surface flatness of the metal gasket is greater than or equal to the flatness threshold, then the measured surface flatness of the metal gasket is determined to be abnormal; otherwise, the measured surface flatness of the metal gasket is determined to be normal.

9. A surface flatness measurement system for metal products, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.