Measurement error correction method based on two-dimensional straight line fitting

Through two-dimensional linear fitting and rotation technology, the problem of error correction difficulties in traditional measurement methods is solved, and more accurate verticality measurement is achieved, providing important support for product quality control.

CN119245589APending Publication Date: 2025-01-03STATE GRID SHAANXI ELECTRIC POWER CO LTD XIXIAN NEW DISTRICT POWER SUPPLY CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411284078.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Traditional verticality measurement methods are easily affected by subjective factors of the operator, and data processing is cumbersome, making it difficult to effectively eliminate and correct measurement errors.

Method used

The measurement error correction method based on two-dimensional linear fitting is used to fit the measurement data through the least squares method to obtain the vector of the two-dimensional straight line, calculate the centroid and rotate the two-dimensional straight line to correct its direction, and determine whether the perpendicularity of the measured object reaches the pre-predict Set standards.

Benefits of technology

Through the rotation of vectors and centroids of two-dimensional straight lines, the actual perpendicularity of the object to be measured is truly reflected, providing theoretical and practical guidance for product quality control and improving measurement accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119245589A_ABST
    Figure CN119245589A_ABST
Patent Text Reader

Abstract

The invention provides a measurement error correction method based on two-dimensional straight line fitting, and the method comprises the steps: placing a measured object on a verticality instrument, and obtaining the measurement data of the measured object; the measurement data is a set formed by a plurality of two-dimensional points; fitting measurement data through a least square method to obtain a vector of a two-dimensional straight line; calculating the center of mass of the two-dimensional straight line; rotating the two-dimensional straight line according to the vector and the mass center of the two-dimensional straight line to correct the direction of the two-dimensional straight line; and judging whether the perpendicularity of the measured object reaches a preset standard or not according to the corrected two-dimensional straight line. The direction of the two-dimensional straight line is corrected by rotating the two-dimensional straight line through the vector and the mass center of the two-dimensional straight line, the actual perpendicularity of the measured object can be truly reflected, and important theoretical support and practical guidance are provided for quality control of products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of measurement error correction, and in particular to a measurement error correction method based on two-dimensional straight line fitting. Background Art

[0002] In modern manufacturing and engineering fields, measurement accuracy is crucial to product quality control. Especially in situations involving verticality measurement, how to effectively eliminate and correct errors in the measurement process has become one of the research hotspots. Traditional verticality measurement methods often rely on manual operation, the measurement process is easily affected by the subjective factors of the operator, and the data processing is cumbersome, which often fails to achieve the desired effect. Summary of the invention

[0003] In order to overcome the deficiencies of the prior art, an object of the present invention is to provide a measurement error correction method based on two-dimensional straight line fitting.

[0004] To achieve the above objectives, the present invention provides the following solutions:

[0005] A measurement error correction method based on two-dimensional straight line fitting, comprising:

[0006] Step 1: placing the object to be measured on the verticality instrument and obtaining measurement data of the object to be measured; the measurement data is a set formed by multiple two-dimensional points;

[0007] Step 2: Get the vector of the two-dimensional straight line by fitting the measured data through the least square method;

[0008] Step 3: Calculate the centroid of the two-dimensional straight line;

[0009] Step 4: Rotate the two-dimensional straight line according to the vector and the centroid of the two-dimensional straight line to correct the direction of the two-dimensional straight line;

[0010] Step 5: Determine whether the verticality of the object under test meets the preset standard based on the corrected two-dimensional straight line.

[0011] Preferably, the calculating the centroid of the two-dimensional straight line includes:

[0012] Using the formula:

[0013]

[0014] Calculate the centroid of a two-dimensional line; where Linpt2d(X,Y) represents the centroid of the two-dimensional line, Xi represents the horizontal coordinate of the i-th two-dimensional point in the measurement data, Yi represents the vertical coordinate of the i-th two-dimensional point in the measurement data, and n represents the number of two-dimensional points in the measurement data.

[0015] Preferably, the step 4: rotating the two-dimensional straight line according to the vector and the center of mass of the two-dimensional straight line to correct the direction of the two-dimensional straight line comprises:

[0016] Step 4.1: Convert the centroid of the two-dimensional line Linpt2d(X, Y) and the vector of the two-dimensional line LinVec2d(i, j) into three-dimensional coordinates respectively, to form the centroid of the three-dimensional line Linpt3d(X, Y, 0) and the vector of the three-dimensional line LinVec3d(i, j, 0);

[0017] Step 4.2: Calculate the distances between all points in the measurement data and the centroid of the three-dimensional line Linpt3d(X, Y, 0) and the three-dimensional line vector LinVec3d(i, j, 0) and sum them up;

[0018] Step 4.3: Calculate the first mean of the distance sum;

[0019] Step 4.4: Rotate the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined.

[0020] Preferably, the step 4.4: rotating the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined, comprises:

[0021] Rotate the three-dimensional line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional line counterclockwise along the rotation axis (0, 0, 1) at a preset angle;

[0022] Recalculate the second mean of the sum of the distances between the centroid of the rotated three-dimensional straight line and the three-dimensional straight line vector and all the points in the measurement data;

[0023] The direction of the corrected two-dimensional straight line is determined according to the magnitude of the second mean and the first mean.

[0024] Preferably, determining the direction of the corrected two-dimensional straight line according to the magnitude of the second mean and the first mean includes:

[0025] When the first mean is greater than the second mean, and the difference between the second mean and the first mean is less than the accuracy threshold, the direction of the rotated three-dimensional straight line vector is used as the direction of the corrected two-dimensional straight line;

[0026] When the first mean is greater than the second mean, and the difference between the second mean and the first mean is greater than the accuracy threshold, the three-dimensional straight line vector and the centroid of the three-dimensional straight line are rotated again.

[0027] Preferably, the step 4.4: rotating the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined, comprises:

[0028] Rotate the three-dimensional line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional line in a clockwise direction along the rotation axis (0, 0, -1) at a preset angle;

[0029] Recalculate the second mean of the sum of the distances between the centroid of the rotated three-dimensional straight line and the three-dimensional straight line vector and all the points in the measurement data;

[0030] The direction of the corrected two-dimensional straight line is determined according to the magnitude of the second mean and the first mean.

[0031] Preferably, determining the direction of the corrected two-dimensional straight line according to the magnitude of the second mean and the first mean includes:

[0032] When the first mean is greater than the second mean, and the difference between the second mean and the first mean is less than the accuracy threshold, the direction of the rotated three-dimensional straight line vector is used as the direction of the corrected two-dimensional straight line;

[0033] When the first mean is greater than the second mean, and the difference between the second mean and the first mean is greater than the accuracy threshold, the three-dimensional straight line vector and the centroid of the three-dimensional straight line are rotated again.

[0034] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory and the processor are connected via the bus, and characterized in that when the computer program is executed by the processor, the steps in the above-mentioned measurement error correction method based on two-dimensional straight line fitting are implemented.

[0035] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps in the above-mentioned measurement error correction method based on two-dimensional straight line fitting are implemented.

[0036] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0037] The present invention provides a measurement error correction method based on two-dimensional straight line fitting. Compared with the prior art, the present invention corrects the direction of a two-dimensional straight line by rotating the two-dimensional straight line through the vector and centroid of the two-dimensional straight line, which can truly reflect the actual verticality of the measured object and provide important theoretical support and practical guidance for product quality control. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0039] Figure 1 A flow chart of a measurement error correction method based on two-dimensional straight line fitting provided by the present invention;

[0040] Figure 2 This is a schematic diagram of the linear rotation principle provided by the present invention. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0043] The terms "first", "second", "third" and "fourth" in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps, processes, methods, etc. are not limited to the listed steps, but may optionally include steps that are not listed, or may optionally include other step elements inherent to these processes, methods, products or devices.

[0044] In order to make the above-mentioned objectives, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0045] In some cases in practice, it is necessary to measure the straightness of an object (to evaluate whether the corners of an object are on a straight line: straight or not). At this time, it is necessary to determine a measurement plane, and then use special equipment to measure a set of measurement points on the object. After fitting the measurement points into a two-dimensional straight line, the straightness is evaluated. The two-dimensional straight line includes the particle LinPt2d (X, Y) and the direction LinVec2d (I, J). First, the direction LinVec2dStart of the two-dimensional straight line is calculated by the least squares method, and then the particle LinPt2d is calculated. The calculation of the least squares method will produce errors due to the problem of calculation accuracy, so it is necessary to further eliminate the errors caused by the calculation. The least squares method (also known as the least square method) is a mathematical optimization technique that finds the best function match for data by minimizing the sum of squares of errors. This method can easily obtain unknown data and minimize the sum of squares of errors between these obtained data and the actual data. Theoretically, the sum of the distances from all measurement points to the straight line should be the smallest through the least squares method. This distance sum is set as DisSet. However, actual calculation will bring errors. In order to eliminate this error, the present invention provides a measurement error correction method based on two-dimensional straight line fitting.

[0046] See also Figure 1-2 , a measurement error correction method based on two-dimensional straight line fitting, comprising:

[0047] Step 1: placing the object to be measured on the verticality instrument and obtaining measurement data of the object to be measured; the measurement data is a set formed by multiple two-dimensional points;

[0048] In practical applications, the verticality instrument obtains a set of measurement data SetPt(pt1(X1,Y1), pt2(X2,Y2), ...ptN(Xn,Yn)) by contacting and sliding the side head sensor on the object to be measured, where N is the number of points in the set, and X and Y are the values ​​in the direction of the plane axis.

[0049] Step 2: Get the vector of the two-dimensional straight line by fitting the measured data through the least square method;

[0050] Step 3: Calculate the centroid of the two-dimensional straight line and set the accuracy threshold Tol.

[0051] In step 3, the formula can be used:

[0052]

[0053] Calculate the centroid of a two-dimensional line; where Linpt2d(X,Y) represents the centroid of the two-dimensional line, Xi represents the horizontal coordinate of the i-th two-dimensional point in the measurement data, Yi represents the vertical coordinate of the i-th two-dimensional point in the measurement data, and n represents the number of two-dimensional points in the measurement data.

[0054] Step 4: Rotate the two-dimensional straight line according to the vector and the centroid of the two-dimensional straight line to correct the direction of the two-dimensional straight line;

[0055] Furthermore, step 4 includes:

[0056] Step 4.1: Convert the centroid of the two-dimensional line Linpt2d(X, Y) and the vector of the two-dimensional line LinVec2d(i, j) into three-dimensional coordinates respectively, to form the centroid of the three-dimensional line Linpt3d(X, Y, 0) and the vector of the three-dimensional line LinVec3d(i, j, 0);

[0057] Step 4.2: Calculate the distances between all points in the measurement data and the centroid of the three-dimensional line Linpt3d(X, Y, 0) and the three-dimensional line vector LinVec3d(i, j, 0) and sum them up;

[0058] Step 4.3: Calculate the first mean of the distance sum;

[0059] In practical applications, the present invention can calculate the first mean of the sum of distances by the formula: Dis0=Σ(DisPti) / n; wherein i=1-n, DisPti is the distance from the i-th point to the straight line or the centroid.

[0060] Step 4.4: Rotate the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined;

[0061] Among them, step 4.4 includes:

[0062] Step 4.4.1: Rotate the three-dimensional line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional line counterclockwise along the rotation axis (0, 0, 1) at a preset angle;

[0063] Step 4.4.2: Recalculate the second mean of the sum of the distances between the centroid of the rotated 3D straight line and the 3D straight line vector and all the points in the measurement data;

[0064] Step 4.4.3: Determine the direction of the corrected two-dimensional straight line according to the magnitude of the second mean and the first mean.

[0065] Specifically, step 4.4.3 includes:

[0066] When the first mean is greater than the second mean, and the difference between the second mean and the first mean is less than the accuracy threshold, the direction of the rotated three-dimensional straight line vector is used as the direction of the corrected two-dimensional straight line;

[0067] When the first mean value is greater than the second mean value, and the difference between the second mean value and the first mean value is greater than the precision threshold Tol, rotate the three-dimensional straight line vector and the centroid of the three-dimensional straight line again.

[0068] In practical applications, the present invention rotates the 3D straight line LinVec3d(i0, j0, 0), LinPt3d(X0, Y0, 0) in the positive direction (counterclockwise direction) by a small angle AngleSep, with the rotation axis being the z-axis (0, 0, 1), to obtain the straight line LinVec3d(i1, j1, 0), LinPt3d(X1, Y1, 0).

[0069] Calculate the mean value of the sum of the distances from all points in the point set SetPt to the straight line LinVec3d(i1, j1, 0), LinPt3d(X1, Y1, 0), Dis1 = Σ(DisPti) / n, where i = 1 to n, and DisPti is the distance from the i-th point to the straight line.

[0070] When Dis0 > Dis1, LinVec3d(i0, j0, 0) = LinVec3d(i1, j1, 0), and (Dis1 - Dis0) < the precision threshold Tol, then end the calculation and take the direction of the rotated three-dimensional straight line vector as the direction of the corrected two-dimensional straight line, otherwise rotate again.

[0071] When Dis0 < Dis1, end the calculation and use the new rotation direction (opposite direction) to rotate the three-dimensional straight line vector.

[0072] Among them, using the new rotation direction to rotate the three-dimensional straight line vector includes:

[0073] Rotate the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line in the clockwise direction along the rotation axis (0, 0, -1) by a preset angle;

[0074] Recalculate the centroid of the rotated three-dimensional straight line and the second mean value of the sum of the distances between the three-dimensional straight line vector and all points in the measurement data;

[0075] When the first mean value is greater than the second mean value, and the difference between the second mean value and the first mean value is less than the precision threshold, take the direction of the rotated three-dimensional straight line vector as the direction of the corrected two-dimensional straight line;

[0076] When the first mean value is greater than the second mean value, and the difference between the second mean value and the first mean value is greater than the precision threshold, rotate the three-dimensional straight line vector and the centroid of the three-dimensional straight line again.

[0077] Step 5: Determine whether the perpendicularity of the measured object meets the preset standard according to the corrected two-dimensional straight line.

[0078] The present invention corrects the fitting error by finding the minimum value of the sum of the distances from all points in the point set SetPt to the line by rotating a three-dimensional line vector: the least squares principle of a line (the line function is y = a + bx, where a and b are undetermined constants. If Pti (i = 1, 2,..., n) is on a straight line, it can be considered that the relationship between variables is y = ax + b. Generally speaking, these points cannot be on the same straight line. Denote εi = yi - (axi + b), which reflects the deviation between the calculated value y and the actual value yi when using the line y = ax + b to describe x = xi, y = yi. Of course, it is required that the deviation is as small as possible, but since εi can be positive or negative, it cannot be considered that the total deviation When, the function y = ax + b can well reflect the relationship between variables, because at this time the absolute value of each deviation may be very large. To improve this defect, consider using to replace However, since the absolute value is not easy to perform analytical operations, therefore, further use to measure the total deviation. Since the sum of the squares of the deviations being the smallest can ensure that each deviation is not very large. Then the problem is reduced to determining the constants a and b in y = ax + b so that

[0079] is the smallest. The method of determining the coefficients a and b in this way is called the least squares method.) It can be seen that has an extreme value. The sum of the distances from all points in the point set SetPt to the line DisAll = Σ(DisPti), where i = 1 to n, and DisPti is the distance from the i-th point to the line. Let the line formula be Ax + By + C = 0, DisPti = |Axi + Byi + C| / (sqrt(A*A + B*B)) (sqrt is the square root), A = -a, B = 1, C = -b, DisPti = (y - ax - b)*(y - ax - b) / (sqrt((-a)*(-a)+1*1)), because ((-a)*(-a)+1*1)>1

[0080] So DisPti < sqrt((yi - axi - b)*(yi - axi - b)), thus Due to calculation errors, obtained through the least squares method It is not the minimum value. After the straight line on the plane is rotated (only two directions), in three dimensions, if the straight line is in the XY plane, then the rotation direction is Z or -Z. Assume that DisAll0 of the initial straight line obtained by the least square method, then DisAlli<=DisAll0 must be found in the straight line after the initial straight line mass point is rotated as the rotation point, thereby correcting the fitting error. The present invention corrects the direction of a two-dimensional straight line by rotating the two-dimensional straight line through the vector and centroid of the two-dimensional straight line, which can truly reflect the actual verticality of the object being measured and provides important theoretical support and practical guidance for product quality control.

[0081] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory and the processor are connected via the bus, and is characterized in that when the computer program is executed by the processor, the steps in the above-mentioned method for correcting measurement errors based on two-dimensional straight line fitting are implemented. Compared with the prior art, the beneficial effects of the electronic device provided by the present invention are the same as the beneficial effects of the method for correcting measurement errors based on two-dimensional straight line fitting described in the above-mentioned technical solution, and are not elaborated herein.

[0082] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps in the above-mentioned measurement error correction method based on two-dimensional straight line fitting are implemented. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present invention are the same as the beneficial effects of the measurement error correction method based on two-dimensional straight line fitting described in the above-mentioned technical solution, which will not be repeated here.

[0083] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the device disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the device part description.

[0084] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A measurement error correction method based on two-dimensional straight line fitting, characterized in that: include: Step 1: placing the object to be measured on the verticality instrument and obtaining measurement data of the object to be measured; the measurement data is a set formed by multiple two-dimensional points; Step 2: Get the vector of the two-dimensional straight line by fitting the measured data through the least square method; Step 3: Calculate the centroid of the two-dimensional straight line; Step 4: Rotate the two-dimensional straight line according to the vector and the centroid of the two-dimensional straight line to correct the direction of the two-dimensional straight line; Step 5: Determine whether the verticality of the object under test meets the preset standard based on the corrected two-dimensional straight line.

2. A measurement error correction method based on two-dimensional straight line fitting as claimed in claim 1, characterized in that: The calculating the centroid of the two-dimensional straight line comprises: Using the formula: Calculate the centroid of a two-dimensional line; where Linpt2d(X,Y) represents the centroid of the two-dimensional line, Xi represents the horizontal coordinate of the i-th two-dimensional point in the measurement data, Yi represents the vertical coordinate of the i-th two-dimensional point in the measurement data, and n represents the number of two-dimensional points in the measurement data.

3. A measurement error correction method based on two-dimensional straight line fitting as claimed in claim 2, characterized in that: The step 4: rotating the two-dimensional straight line according to the vector and the center of mass of the two-dimensional straight line to correct the direction of the two-dimensional straight line includes: Step 4.1: Convert the centroid of the two-dimensional line Linpt2d(X, Y) and the vector of the two-dimensional line LinVec2d(i, j) into three-dimensional coordinates respectively, to form the centroid of the three-dimensional line Linpt3d(X, Y, 0) and the vector of the three-dimensional line LinVec3d(i, j, 0); Step 4.2: Calculate the distances between all points in the measurement data and the centroid of the three-dimensional line Linpt3d(X, Y, 0) and the three-dimensional line vector LinVec3d(i, j, 0) and sum them up; Step 4.3: Calculate the first mean of the distance sum; Step 4.4: Rotate the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined.

4. A measurement error correction method based on two-dimensional straight line fitting as claimed in claim 3, characterized in that: The step 4.4: rotating the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined, includes: Rotate the three-dimensional line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional line counterclockwise along the rotation axis (0, 0, 1) at a preset angle; Recalculate the second mean of the sum of the distances between the centroid of the rotated three-dimensional straight line and the three-dimensional straight line vector and all the points in the measurement data; The direction of the corrected two-dimensional straight line is determined according to the magnitude of the second mean and the first mean.

5. A measurement error correction method based on two-dimensional straight line fitting as claimed in claim 4, characterized in that: Determining the direction of the corrected two-dimensional straight line according to the magnitude of the second mean and the first mean includes: When the first mean is greater than the second mean, and the difference between the second mean and the first mean is less than the accuracy threshold, the direction of the rotated three-dimensional straight line vector is used as the direction of the corrected two-dimensional straight line; When the first mean is greater than the second mean, and the difference between the second mean and the first mean is greater than the accuracy threshold, the three-dimensional straight line vector and the centroid of the three-dimensional straight line are rotated again.

6. A measurement error correction method based on two-dimensional straight line fitting as claimed in claim 3, characterized in that: The step 4.4: rotating the three-dimensional straight line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional straight line according to the first mean of the distance and until the direction of the corrected two-dimensional straight line is determined, includes: Rotate the three-dimensional line vector LinVec3d(i, j, 0) and the centroid Linpt3d(X, Y, 0) of the three-dimensional line in a clockwise direction along the rotation axis (0, 0, -1) at a preset angle; Recalculate the second mean of the sum of the distances between the centroid of the rotated three-dimensional straight line and the three-dimensional straight line vector and all the points in the measurement data; The direction of the corrected two-dimensional straight line is determined according to the magnitude of the second mean and the first mean.

7. A measurement error correction method based on two-dimensional straight line fitting as claimed in claim 6, characterized in that: The step of determining the direction of the corrected two-dimensional straight line according to the magnitude of the second mean and the first mean includes: When the first mean is greater than the second mean, and the difference between the second mean and the first mean is less than the accuracy threshold, the direction of the rotated three-dimensional straight line vector is used as the direction of the corrected two-dimensional straight line; When the first mean is greater than the second mean, and the difference between the second mean and the first mean is greater than the accuracy threshold, the three-dimensional straight line vector and the centroid of the three-dimensional straight line are rotated again.

8. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps of a measurement error correction method based on two-dimensional straight line fitting as described in any one of claims 1 to 7 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in a measurement error correction method based on two-dimensional straight line fitting as described in any one of claims 1 to 7 are implemented.