A method and device for measuring flatness

By constructing a polyhedron to screen boundary points and iteratively optimizing and calculating the distance between parallel planes, the problem of low efficiency of flatness measurement in high-throughput non-contact optical three-dimensional sensors and online real-time measurement is solved, and efficient and accurate flatness measurement is achieved.

CN115388814BActive Publication Date: 2025-09-26SHENZHEN LINGYUN VISION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210250183.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-14
Publication Date
2025-09-26
Estimated Expiration
2042-03-14

AI Technical Summary

Technical Problem

When faced with millions or even tens of millions of input points, traditional methods consume a long time and have low efficiency in flatness measurement calculations, making them unsuitable for high-throughput non-contact optical 3D sensors and online real-time measurement scenarios.

Method used

By obtaining a set of three-dimensional points on the measured surface, constructing a polyhedron, selecting boundary points, eliminating non-boundary points, iterative optimization, calculating the distance between parallel planes, and finally determining the flatness value, the number of points can be reduced by using rigid body transformation and polyhedron screening to improve measurement efficiency.

Benefits of technology

It achieves efficient flatness measurement at more than one million input points, and is suitable for high-throughput non-contact optical 3D sensors and online real-time measurement scenarios, with fast calculation speed and accurate results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115388814B_ABST
    Figure CN115388814B_ABST
Patent Text Reader

Abstract

The present application provides a flatness measurement method and device to solve the technical problem of low measurement efficiency for input points of more than one million when measuring flatness. The present application provides a flatness measurement method comprising: selecting boundary points to construct a polyhedron, using the polyhedron as the ROI (region of interest), screening the points in the three-dimensional point set, and eliminating a large number of points located inside the polyhedron; selecting at least four points based on the eliminated three-dimensional point set to calculate the parallel planes with the smallest spacing; each time a pair of parallel planes is calculated, the middle plane of the parallel plane is used as a reference to perform a rigid body transformation on the three-dimensional points; after the rigid body transformation, at least four points are selected to construct a polyhedron, and the points where the measurement points are concentrated inside the polyhedron are eliminated. After each cycle, the number of points in the three-dimensional point set becomes less than that of the previous cycle. Thus, when measuring flatness, the measurement efficiency for input points of more than one million is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of mechanical detection technology, and in particular to a flatness measurement method and device. Background Art

[0002] The new national standard for geometric tolerances GB / T 11337-2004 stipulates that flatness tolerance refers to the distance of the measured element relative to an ideal plane, where the direction of the ideal plane is determined by the minimum condition, that is, a pair of parallel planes enclose the measured element and their distance is minimum.

[0003] Currently, flatness measurement uses a three-coordinate measuring machine to sample the measured surface, obtaining dozens to hundreds of data points. Then, methods such as Chebyshev plane fitting, simplex downhill method, ant colony algorithm and genetic algorithm are used to determine the ideal plane and calculate the plane measurement value.

[0004] However, traditional methods generally deal with input data ranging from tens to thousands of points, and suffer from long computation time and low efficiency when dealing with input points in the millions or even tens of millions. These methods are not suitable for application scenarios that use high-throughput non-contact optical three-dimensional sensors for measurement, let alone online, real-time measurement scenarios. Summary of the Invention

[0005] The present application provides a flatness measurement method and device to solve the technical problem of low measurement efficiency when measuring flatness with input points on the order of millions or more.

[0006] In a first aspect, the present application provides a flatness measurement method, comprising:

[0007] S1, obtaining a three-dimensional point set of the measured surface; the three-dimensional point set represents the shape and posture of the measured surface;

[0008] S2, confirm the fitting plane corresponding to the three-dimensional point set;

[0009] S3, establishing a first spatial rectangular coordinate system O-XYZ with the fitting plane as a reference plane; and updating position information of each point in the three-dimensional point set in the first spatial rectangular coordinate system;

[0010] S4, selecting at least four points to construct a polyhedron based on the position information;

[0011] S5, determining a first point set based on the polyhedron, where the first point set includes a set of points on each end face of the polyhedron and points outside the polyhedron;

[0012] S6, traversing the first point set and determining a second point set; the second point set includes at least four points that are farthest from the fitting plane along the Z axis;

[0013] S7, confirming a pair of parallel planes based on the second point set, where the parallel planes are the pair of parallel planes with the smallest distance among all the pairs of parallel planes confirmed by the second point set;

[0014] s8, calculate the middle plane of the parallel planes; the distance between the middle plane and each plane in the parallel plane is equal;

[0015] S9, determining whether the second point set or the parallel plane meets a preset condition; if so, the process ends; if not, the process proceeds to S10;

[0016] S10, establishing a second spatial rectangular coordinate system C-XYZ with the middle plane as the reference plane; and updating the position information of each point in the three-dimensional point set in the second spatial rectangular coordinate system C-XYZ; and repeating S4-S9.

[0017] In some embodiments, at least four points are selected based on the position information to construct a polyhedron; the method includes: selecting the coordinate D along the x-axis direction in the three-dimensional point set; x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value, coordinate D along the z-axis y The endpoint with the smallest value, D z The endpoint with the largest value and D z The endpoint with the smallest value is used to construct an octahedron.

[0018] In some embodiments, the flatness measurement method further includes: calculating the distance between parallel planes; the preset condition includes: the change in the distance between two consecutive parallel planes is less than a set threshold.

[0019] In some embodiments, the preset condition further includes: the coordinates of the four points constructing the parallel planes in the two previous and subsequent cycles are the same.

[0020] In some embodiments, the preset condition further includes: the indexes of the four points in the two consecutive cycles of constructing the parallel plane are the same.

[0021] In some embodiments, selecting at least four points to construct a polyhedron includes: selecting coordinates D along the x-axis in the three-dimensional point set. x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value and D z The endpoint with the largest value is used to construct a tetrahedron.

[0022] In some embodiments, at least four points are selected to construct a polyhedron; this includes: confirming that the origin of the coordinate system points to the point in any direction that is farthest from the origin of the three-dimensional point set and the coordinate system, and arbitrarily selecting four points that are not in the same plane to construct the polyhedron.

[0023] In some embodiments, determining a fitting plane corresponding to the three-dimensional point set includes fitting the three-dimensional point set using a least squares method to obtain the fitting plane.

[0024] In some embodiments, obtaining a three-dimensional point set of a measured surface includes: scanning the measured surface using an optical three-dimensional sensor to obtain a dense point cloud of the measured surface; and converting the dense point cloud into a three-dimensional point set.

[0025] In a second aspect, the present application provides a flatness measuring device, which includes: an acquisition unit, which is used to acquire a three-dimensional point set of the measured surface; the three-dimensional point set represents the shape and posture of the measured surface; an image processing unit, which is used to confirm the fitting plane corresponding to the three-dimensional point set; establish a first spatial rectangular coordinate system O-XYZ with the fitting plane as the reference plane; and update the position information of each point in the three-dimensional point set in the first spatial rectangular coordinate system; based on the position information, select at least four points to construct a polyhedron; based on the polyhedron, confirm the first point set, the first point set includes the points on each end face of the polyhedron and the set of points outside the polyhedron; traverse the first point set to confirm the second point set; the second point set includes the points corresponding to the fitting plane At least four points that are farthest apart along the Z-axis; based on the second point set, confirm a pair of parallel planes, which are the pair of parallel planes with the smallest distance among all the parallel plane pairs confirmed by the second point set; calculate the middle plane of the parallel planes; the distance between the middle plane and each plane in the parallel planes is equal; a judgment unit, the judgment unit is used to judge whether the second point set or the parallel planes meet the preset conditions; if the preset conditions are met, it ends; if the preset conditions are not met, a system establishment instruction is sent to the image processing unit; the image processing unit also establishes a second space rectangular coordinate system C-XYZ with the middle plane as the reference plane in response to the system establishment instruction; and updates the position information of each point in the three-dimensional point set in the second space rectangular coordinate system C-XYZ.

[0026] As can be seen from the above examples, after each calculation of a pair of parallel planes, the present application performs a rigid body transformation on the three-dimensional points, using the midplane of these parallel planes as a reference. After this rigid body transformation, at least four points are selected to construct a polyhedron, and points whose measurement points are concentrated within the polyhedron are eliminated. After each cycle, the number of points in the three-dimensional point set decreases compared to the previous cycle. This improves the efficiency of measuring flatness for input points exceeding one million. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0028] Figure 1 A diagram illustrating an application scenario of a flatness measurement method provided in an embodiment of the present application;

[0029] Figure 2 A schematic diagram of a process for measuring flatness provided in an embodiment of the present application;

[0030] Figure 3a A schematic diagram of a fitting plane provided in an embodiment of the present application;

[0031] Figure 3b A schematic diagram of a scenario of a flatness measurement method provided in an embodiment of the present application;

[0032] Figure 4 A schematic diagram of establishing a second spatial rectangular coordinate system with the middle plane as the reference plane in a flatness measurement method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following is a complete and clear description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0034] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.

[0035] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or sequence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.

[0036] The terms "comprise," "include," and "have," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0037] Flatness refers to the deviation of the substrate's macroscopic convex height from an ideal plane. The orientation of the ideal plane is determined by the minimum condition: a pair of parallel planes encompassing the measured element with a minimum spacing between them. Flatness limits the amount of variation in the actual surface from the ideal plane and is used to control the shape error of the measured surface. Flatness error is calculated by comparing the measured surface with the ideal plane; the linear distance between the two is the flatness error.

[0038] The evaluation method for flatness error includes the least squares method, which uses the least squares plane of the actual measured surface as the evaluation reference plane, and the distance between two inclusive planes that are parallel to the least squares plane and have the minimum distance as the flatness error value. The least squares plane is the plane that minimizes the sum of the squares of the distances between each point on the actual measured surface and the plane. This method is relatively complex to calculate and generally requires computer processing. The input data generally faced by computer processing is generally on the order of tens to thousands of points. When it comes to input points on the order of millions or even tens of millions, there are problems with long calculation time and low efficiency. It is not suitable for application scenarios using high-throughput non-contact optical three-dimensional sensors for measurement, let alone online, real-time measurement scenarios.

[0039] In order to solve the above-mentioned flatness measurement problem with input data in the order of millions or even tens of millions, the present application provides a flatness measurement method, which iteratively optimizes the boundary points of the macroscopic convex height in the actual surface to be measured, eliminates non-boundary points, and finally finds four boundary points that can define the minimum spacing parallel to the ideal plane, thereby calculating the minimum spacing parallel to the boundary points and the flatness measurement value that meets the minimum inclusion condition.

[0040] Figure 1 This is an application scenario diagram of a flatness measurement method provided in an embodiment of the present application. Figure 1 As shown, the measured actual surface 100 is located between the first plane 200 and the second plane 300, and the distance between the first plane 200 and the second plane 300 is the flatness measurement value.

[0041] Figure 2 This is a flow chart of a flatness measurement method provided in an embodiment of the present application. Figure 2 As shown, the flatness measurement method provided in the embodiment of the present application includes:

[0042] S1, obtaining a three-dimensional point set of the measured surface; the three-dimensional point set represents the shape and posture of the measured surface.

[0043] In some embodiments, as Figure 3b As shown, a three-dimensional point set 600 of the measured surface can be acquired by a sensor.

[0044] In one implementation, Figure 3b As shown, the three-dimensional point set 600 can be obtained by scanning the measured surface with an optical three-dimensional sensor, thereby obtaining a dense point cloud of the measured surface, and finally converting the dense point cloud into the three-dimensional point set 600.

[0045] S2, confirm the fitting plane corresponding to the three-dimensional point set.

[0046] like Figure 3a As shown, in one implementation, a plane fitting is performed on the three-dimensional point set to obtain a fitting plane 101. The plane fitting method may adopt the least square method.

[0047] S3, establishing a first spatial rectangular coordinate system with the fitting plane as a reference plane; and updating position information of each point in the three-dimensional point set in the first spatial rectangular coordinate system.

[0048] like Figure 3b As shown, in one implementation, a first spatial rectangular coordinate system O-XYZ is established with the fitting plane as the base plane. The center of the fitting plane is the coordinate origin O, and the fitting plane is the XOY plane in the first spatial rectangular coordinate system. With the first spatial rectangular coordinate system O-XYZ as the reference, the three-dimensional point set 600 is rigidly transformed, and the position information of each point in the three-dimensional point set 600 is updated. During the rigid body transformation, the three-dimensional point set 600 is regarded as a rigid body, its shape and size (dimensions) remain unchanged, and the relative positions of the various parts inside the three-dimensional point set 600 remain constant; rigid body transformation refers to treating the three-dimensional point set 600 as a rigid body and performing rotation, translation and mirror-symmetric movements on the aforementioned rigid body. In this way, after the three-dimensional point set 600 is transformed into the first spatial rectangular coordinate system O-XYZ, the new position information of each point in the three-dimensional point set 600 is obtained. The position information includes the coordinate D of each point along the x-axis in the coordinate system O-XYZ. x , coordinate D along the y-axis y and the coordinate D along the z-axis z It is understood that coordinate values ​​can be positive or negative, with a positive coordinate value indicating alignment with the positive direction of the coordinate axis and a negative coordinate value indicating alignment with the negative direction of the coordinate axis.

[0049] S4: Select at least four points based on the position information to construct a polyhedron. For ease of description, the selected at least four points are referred to as boundary points in the following text.

[0050] In one embodiment, if Figure 3b As shown, select D x The endpoint with the largest value, D x The endpoint with the smallest value, D y The endpoint with the largest value, D y The endpoint with the smallest value, Dz The endpoint with the largest value and D z The endpoint with the smallest value is a total of six endpoints to construct the octahedron 500. It should be noted that the aforementioned D x Value, D y Value and D z As mentioned in step S3, the coordinate values ​​may be positive or negative. When selecting the maximum and minimum values, the positive and negative values ​​should be considered. Figure 3b As shown, the endpoints of the polyhedron include a first endpoint 1, a second endpoint 2, a third endpoint 3, a fourth endpoint 4, a fifth endpoint 5, and a sixth endpoint 6. The six endpoints are connected to form a first octahedron. It is understood that in some cases, some endpoints may overlap, for example, D x The endpoint with the largest value and D y The endpoint with the largest value may coincide, making the polyhedron have fewer than six endpoints. When the polyhedron has five endpoints, it can form a hexahedron; when the polyhedron has four endpoints, it can form a tetrahedron.

[0051] In some embodiments, selecting at least four points to construct a polyhedron includes: selecting coordinates D along the x-axis in the three-dimensional point set. x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value and D z The endpoint with the largest value is used to construct a tetrahedron.

[0052] In some embodiments, at least four points are selected to construct a polyhedron; this includes: confirming that the origin of the coordinate system points to the point in any direction that is farthest from the origin of the three-dimensional point set and the coordinate system, and arbitrarily selecting four points that are not in the same plane to construct the polyhedron.

[0053] S5. Determine a first point set based on the polyhedron. The first point set includes a set of points on each end face of the polyhedron and points outside the polyhedron.

[0054] S6. Traverse the first point set and identify a second point set. The second point set includes a point with the greatest distance from the fitting plane along the positive Z-axis, a point with the second greatest distance from the fitting plane along the positive Z-axis, a point with the greatest distance from the fitting plane along the negative Z-axis, and a point with the second greatest distance from the fitting plane along the negative Z-axis, for a total of four points. Specifically, the points in the first point set are arranged in ascending order of distance from the fitting plane along the Z-axis, and the first, second, last, and last points are selected as points in the second point set. It should be noted that in the embodiments of the present application, the distances are both positive and negative. For points on the side of the fitting plane pointing in the positive Z-axis, the distance from the fitting plane is positive; for points on the side of the fitting plane pointing in the negative Z-axis, the distance from the fitting plane is negative. When arranging the points in order of magnitude, the positive and negative values ​​should be considered. It is understood that when the same distance corresponds to multiple points, the points should be arranged sequentially. This application does not limit the arrangement of the points in this order.

[0055] like Figure 3b As shown, in a certain implementation, the point farthest from the fitting plane along the positive direction of the Z axis is the second endpoint 2, the point second farthest from the fitting plane along the positive direction of the Z axis is the third endpoint 3, the point farthest from the fitting plane along the negative direction of the Z axis is the fifth endpoint 5, and the point second farthest from the fitting plane along the negative direction of the Z axis is the sixth endpoint 6.

[0056] S7, confirming a pair of parallel planes based on the second point set, where the pair of parallel planes has the smallest distance among all the pairs of parallel planes confirmed by the second point set.

[0057] like Figure 3b As shown, in a certain implementation, a pair of parallel planes are identified based on the second endpoint 2 , the third endpoint 3 , the fifth endpoint 5 and the sixth endpoint 6 , and the parallel planes are respectively the first plane 200 and the second plane 300 .

[0058] S8, calculating the distance between the parallel planes, and calculating the middle plane of the parallel planes;

[0059] like Figure 3b As shown, in a certain implementation, the distance between the first plane 200 and the second plane 300 is calculated. At the same time, the middle plane 400 between the first plane 200 and the second plane 300 is calculated.

[0060] S9, determines whether the change in the distance between the two parallel planes is less than a set threshold. If so, the process ends. If the change in the distance between the two parallel planes is greater than or equal to the set threshold, S10 is executed. It should be noted that after calculating the distance between the parallel planes for the first time, when determining the change in the distance between the two parallel planes, the previous distance change is considered to be zero.

[0061] S10, such as Figure 4 As shown, a second rectangular coordinate system C-XYZ is established with midplane 400 as the reference plane. The position information of each point in the three-dimensional point set in the second rectangular coordinate system C-XYZ is updated. Steps S4-S9 are repeated until the difference in the distance between the two parallel planes is less than a set threshold. The distance between the two parallel planes is then output as the flatness measurement value.

[0062] As can be seen from the above embodiments, the present application constructs a polyhedron by selecting boundary points, takes the polyhedron as ROI (region of interest), screens the points in the three-dimensional point set, and eliminates a large number of points located inside the polyhedron. Then, in the remaining point set, iterative optimization is performed to find four boundary points that can define the minimum spacing parallel planes, and the minimum spacing parallel and the flatness measurement value that meets the minimum inclusion condition can be calculated from the boundary points. During the entire measurement process, the three-dimensional point set undergoes multiple rigid body transformations, so that the method described in the present invention can converge to the global optimal solution, and the calculated flatness value meets the minimum inclusion condition, so that the result calculated by the method is accurate; after each cycle of calculation, the number of points in the three-dimensional point set is greatly reduced due to the elimination step, so that the method described in the present invention has a fast calculation speed and high efficiency, and can be applied to scenarios where large-scale three-dimensional point sets are calculated for flatness.

[0063] In some embodiments, the condition for ending the "repeated execution of S4-S9" loop process may also be "determining whether the coordinates of the four points of the parallel planes constructed in the two previous and subsequent loops are the same; if the coordinates of the four points of the parallel planes constructed in the two previous and subsequent loops are the same, then ending the process; if the coordinates of the four points of the parallel planes constructed in the two previous and subsequent loops are different, then executing step S10 in the aforementioned embodiment."

[0064] In some embodiments, the condition for ending the "repeated execution of S4-S9" loop process may also be "determining whether the indices of the four points in the parallel planes constructed in the two previous and subsequent loops are the same; if the indices of the four points in the parallel planes constructed in the two previous and subsequent loops are the same, then ending the process; if the indices of the four points in the parallel planes constructed in the two previous and subsequent loops are different, then executing step S10 in the aforementioned embodiment."

[0065] In some embodiments, constructing a polyhedron may be constructing a convex polyhedron with any number of faces by selecting any number (greater than three) of farthest endpoints in any specified direction.

[0066] In some embodiments, the flatness measurement method may include first constructing a polyhedron, then performing a rigid body transformation, and finally removing points inside the polyhedron.

[0067] The present application also provides a flatness measuring device, the device comprising: an acquisition unit, the acquisition unit being used to acquire a three-dimensional point set of a measured surface; the three-dimensional point set representing the shape and posture of the measured surface; an image processing unit, the image processing unit being used to confirm a fitting plane corresponding to the three-dimensional point set; establishing a first spatial rectangular coordinate system O-XYZ with the fitting plane as a reference plane and updating position information of each point in the three-dimensional point set in the first spatial rectangular coordinate system; selecting at least four points based on the position information to construct a polyhedron; confirming a first point set based on the polyhedron, the first point set including points on each end face of the polyhedron and a set of points outside the polyhedron; traversing the first point set to confirm a second point set; the second point set including points corresponding to the fitting plane along Z At least four points with the farthest distance in the axial direction; according to the second point set, a pair of parallel planes are confirmed, and the parallel planes are the parallel plane pairs with the smallest distance among all the parallel plane pairs confirmed by the second point set; the middle plane of the parallel planes is calculated; the distance between the middle plane and each plane in the parallel planes is equal; a judgment unit, the judgment unit is used to judge whether the second point set or the parallel planes meet the preset conditions; if the preset conditions are met, it ends; if the preset conditions are not met, a system establishment instruction is sent to the image processing unit; the image processing unit also establishes a second space rectangular coordinate system C-XYZ with the middle plane as the reference plane in response to the system establishment instruction, and updates the position information of each point in the three-dimensional point set in the second space rectangular coordinate system C-XYZ.

[0068] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, the embodiments should be regarded as illustrative and non-restrictive in all respects. The scope of the present invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be included therein.

[0069] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.

[0070] Similar parts between the embodiments provided in the present invention can be referenced to each other. The specific embodiments provided above are merely examples of the overall concept of the present invention and do not constitute a limitation on the scope of protection of the present invention. For those skilled in the art, any other embodiments expanded based on the scheme of the present invention without expending creative work shall fall within the scope of protection of the present invention.

Claims

1. A flatness measurement method, characterized in that: include: S1, obtaining a three-dimensional point set of the measured surface; the three-dimensional point set represents the shape and posture of the measured surface; S2, confirming the fitting plane corresponding to the three-dimensional point set; S3, establishing a first spatial rectangular coordinate system O-XYZ with the fitting plane as a reference plane; and updating position information of each point in the three-dimensional point set in the first spatial rectangular coordinate system; S4, selecting at least four points based on the position information to construct a polyhedron, including: Select the coordinate D along the x-axis in the three-dimensional point set x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value, coordinate D along the z-axis y The endpoint with the smallest value, D z The endpoint with the largest value and D z The endpoint with the smallest value constructs an octahedron; Alternatively, the selecting at least four points to construct a polyhedron includes: Select the coordinate D along the x-axis in the three-dimensional point set x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value and D z The endpoint with the largest value is used to construct a tetrahedron; Alternatively, the selecting at least four points to construct a polyhedron includes: Confirm that the origin O of the coordinate system points to the point in any direction that is farthest from the three-dimensional point set and the origin O of the coordinate system, and arbitrarily select four points that are not in the same plane from the three-dimensional point set to construct a polyhedron; S5, determining a first point set based on the polyhedron, where the first point set includes a set of points on each end face of the polyhedron and points outside the polyhedron; S6, traversing the first point set and determining a second point set; the second point set includes at least four points that are farthest from the fitting plane along the Z-axis direction, and the at least four points include at least one point farthest from the fitting plane along the positive direction of the Z-axis, one point second farthest from the fitting plane along the positive direction of the Z-axis, one point farthest from the fitting plane along the negative direction of the Z-axis, and one point second farthest from the fitting plane along the negative direction of the Z-axis; S7, identifying a pair of parallel planes based on the second point set, where the pair of parallel planes has the smallest distance among all pairs of parallel planes identified by the second point set; S8, calculating a middle plane of the parallel planes; the distance between the middle plane and each plane in the parallel planes is equal; S9, determining whether the second point set or the parallel planes meet a preset condition; if so, the process ends, and the distance between the parallel planes is the flatness measurement value; if not, the process proceeds to S10; The preset conditions include: the coordinates of the four points constructing the parallel plane are the same in the two previous and next cycles; The preset condition also includes: the indexes of the four points in the two cycles of constructing the parallel plane are the same; S10, establishing a second spatial rectangular coordinate system C-XYZ with the middle plane as the reference plane; and updating the position information of each point in the three-dimensional point set in the second spatial rectangular coordinate system C-XYZ; then, repeating S4-S9.

2. The flatness measurement method according to claim 1, wherein: Also includes: calculating the distance between the parallel planes; The preset condition includes: the distance change between two parallel planes is less than a set threshold.

3. The flatness measurement method according to claim 1 or 2, characterized in that: The step of confirming the fitting plane corresponding to the three-dimensional point set comprises: The three-dimensional point set is fitted using the least squares method to obtain a fitting plane.

4. The flatness measurement method according to claim 3, wherein: The step of obtaining a three-dimensional point set of the measured surface comprises: Use an optical three-dimensional sensor to scan the surface to be measured and obtain a dense point cloud of the surface to be measured; Convert a dense point cloud into a 3D point set.

5. A flatness measuring device, characterized in that: The device comprises: An acquisition unit, configured to acquire a three-dimensional point set of the measured surface; the three-dimensional point set represents the shape and posture of the measured surface; An image processing unit is configured to determine a fitting plane corresponding to the three-dimensional point set; establish a first spatial rectangular coordinate system O-XYZ with the fitting plane as a reference plane; and update position information of each point in the three-dimensional point set in the first spatial rectangular coordinate system; select at least four points based on the position information to construct a polyhedron, including: selecting a coordinate D along the x-axis in the three-dimensional point set; x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value, coordinate D along the z-axis y The endpoint with the smallest value, D z The endpoint with the largest value and D z The endpoint with the smallest value is used to construct an octahedron; or, the method of selecting at least four points to construct a polyhedron includes: selecting the coordinate D along the x-axis direction in the three-dimensional point set. x The endpoint with the largest value, D x The endpoint with the smallest value, coordinate D along the y-axis y The endpoint with the largest value and D z The method comprises the following steps: determining an endpoint with the largest value of the three-dimensional point set in any direction and constructing a tetrahedron; or selecting at least four points to construct a polyhedron; confirming that the origin O of the coordinate system points to the point with the farthest distance from the three-dimensional point set and the origin O of the coordinate system in any direction, and arbitrarily selecting four points that are not in the same plane from the three-dimensional point set to construct a polyhedron; determining a first point set based on the polyhedron, the first point set including points on each end face of the polyhedron and a set of points outside the polyhedron; traversing the first point set to determine a second point set; the second point set including the points with the farthest distance from the fitting plane along the Z axis. at least four points, the at least four points including at least a point farthest from the fitting plane along the positive direction of the Z axis, a point second farthest from the fitting plane along the positive direction of the Z axis, a point farthest from the fitting plane along the negative direction of the Z axis, and a point second farthest from the fitting plane along the negative direction of the Z axis; identifying a pair of parallel planes based on the second point set, the parallel planes being a pair of parallel planes with the smallest distance among all the parallel plane pairs identified by the second point set; calculating a median plane of the parallel planes, wherein the median plane is equidistant from each of the parallel planes; a judgment unit, the judgment unit being configured to judge whether the second point set or the parallel planes meet a preset condition; if so, the process ends, and the distance between the parallel planes is the flatness measurement value; if not, a system establishment instruction is sent to the image processing unit; The preset conditions include: the coordinates of the four points constructing the parallel plane are the same in the two previous and next cycles; The preset condition also includes: the indexes of the four points in the two cycles of constructing the parallel plane are the same; The image processing unit also establishes a second spatial rectangular coordinate system C-XYZ with the middle plane as a reference plane in response to the system establishment instruction; and updates the position information of each point in the three-dimensional point set in the second spatial rectangular coordinate system C-XYZ.