Single-plane fitting optimization method and system based on adaptive weight, terminal and storage medium
Patent Information
- Application Number
- CN202610828280.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-09
- Publication Date
- 2026-08-18
AI Technical Summary
该方法对异常点具有较好的鲁棒性,但存在以下固有缺陷:随机采样的点可能空间上过于集中,导致生成的初始模型质量不高,易陷入局部最优;采用固定的距离阈值对内点进行硬分类,未能利用内点之间不同程度的可信度信息,且阈值设定依赖经验,设置不当易导致内点误判或外点混入;其最终结果仅依赖于内点数量,缺乏对已识别内点的进一步优化,拟合精度有限
(1)本发明通过改进RANSAC粗拟合和自适应权重迭代精优化的两阶段协同机制,第一阶段获取稳健初始模型,第二阶段通过动态权重逐步精化,在高噪声、高外点场景下仍能保持亚像素级拟合精度,解决了传统算法难以兼顾抗噪性与精度的问题;
Smart Images

Figure CN122597539A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D point cloud processing technology, and in particular to a single-plane fitting optimization method, system, terminal and storage medium based on adaptive weights. Background Technology
[0002] In the field of 3D point cloud processing and industrial inspection, fitting a planar model with high accuracy and robustness from data containing noise and outliers (outside points) is a fundamental and critical task. Its accuracy directly affects the accuracy of subsequent dimensional measurements such as flatness, step difference, and height.
[0003] Currently, mainstream plane fitting methods mainly include least squares and random sample consensus. Least squares solves for parameters by minimizing the sum of squared distances from all data points to the fitting plane. This method is computationally efficient, but extremely sensitive to outliers; even a small number of outliers can cause the fitted plane to deviate significantly from the true plane, resulting in poor robustness. Random sample consensus, through an iterative process of random sampling, model building, and inlier / outlier classification, finds the model with the most supported inliers. This method has good robustness to outliers, but it has the following inherent drawbacks: randomly sampled points may be spatially too concentrated, leading to a low-quality initial model that is prone to getting trapped in local optima; using a fixed distance threshold for hard classification of inliers fails to utilize the varying degrees of confidence information between inliers, and the threshold setting relies on experience, easily leading to misclassification of inliers or the inclusion of outliers; its final result depends only on the number of inliers, lacking further optimization of identified inliers, resulting in limited fitting accuracy.
[0004] To balance robustness and accuracy, the industry often attempts to combine RANSAC with least squares, using RANSAC to initially eliminate outliers and then using least squares to fit the remaining points. However, this simple cascade combination has significant problems: the hard classification in the RANSAC stage may incorrectly exclude potential valid inliers located at the threshold edge, resulting in information loss or bias in the dataset passed to the least squares stage; while least squares is sensitive to initial values and data noise. If the initial model or inlier set provided by RANSAC is of poor quality, subsequent optimization may fail to converge to the optimal solution, and may even amplify the error.
[0005] Therefore, how to achieve refined utilization of interior point information while maintaining strong noise resistance (effectively excluding outliers) to obtain sub-pixel-level high-precision plane fitting results has become a technical bottleneck that urgently needs to be overcome in this field. Summary of the Invention
[0006] To address the aforementioned issues, this application provides a planar fitting optimization method, system, terminal, and storage medium that can balance noise resistance and sub-pixel-level high accuracy in high-noise, high-outlier 3D point cloud data.
[0007] A single-plane fitting optimization method based on adaptive weights includes the following steps: A three-dimensional point cloud dataset is acquired, and multiple data points are selected from the three-dimensional point cloud data as candidate points based on preset geometric filtering conditions. Initial plane model parameters are generated based on the candidate points, and the initial plane model parameters are used to define the plane equation. An iterative optimization closed loop is constructed, and the iterative optimization closed loop executes the following steps sequentially until a preset convergence condition is met. Calculate the fitting deviation between the initial planar model parameters and all the data points in the 3D point cloud dataset, and assign a contribution weight to each data point based on the fitting deviation, wherein the contribution weight is negatively correlated with the fitting deviation; Based on the contribution weights, the initial planar model parameters are updated using a weighted optimization method to obtain the updated planar model parameters, and it is determined whether the initial planar model parameters and the updated planar model parameters satisfy the preset convergence conditions. If the condition is not met, iterate until the convergence condition is met; if the convergence condition is met, output the updated planar model parameters as the fitting result.
[0008] By employing the above technical solution, a two-stage collaborative mechanism of coarse fitting and fine optimization is formed by combining the generation of the initial planar model with adaptive weight iterative optimization. The first stage obtains a robust initial model, avoiding optimization divergence caused by initial value deviations; the second stage refines the model parameters step by step through adaptive weight iteration. Compared with traditional single algorithms, this method significantly improves fitting accuracy while ensuring noise resistance, achieving highly robust planar fitting of point cloud data containing noise and outliers.
[0009] Preferably, the step of acquiring the 3D point cloud dataset, selecting multiple data points as candidate points from the 3D point cloud data based on preset geometric filtering conditions, and generating initial planar model parameters based on the candidate points, specifically includes the following steps: Obtain a 3D point cloud dataset, randomly select multiple data points from the 3D point cloud dataset, and determine whether the multiple data points are collinear; If they are not collinear, calculate the distance between any two data points among the plurality of data points. If all the distances between the two points are greater than a preset first distance threshold, then the plurality of data points are determined as candidate points. Based on the candidate points, the initial plane model parameters are calculated using the three-point plane equation. The initial plane model parameters satisfy the plane equation. ,and .
[0010] By adopting the above technical solution and introducing distance constraints between the three randomly sampled points, the selected candidate points are ensured to be evenly distributed in space, avoiding initial model bias caused by overly concentrated selection points. This geometric selection condition effectively improves the representativeness of the initial planar model, providing high-quality initial values for subsequent adaptive weight iterative optimization and reducing the risk of the algorithm getting trapped in local optima from the source.
[0011] Preferably, the step of calculating the initial plane model parameters based on the candidate points using the three-point plane equation specifically includes the following steps: Calculate the first point-to-plane distance from all data points in the 3D point cloud dataset to the plane defined by the plane model parameters, and classify the data points into interior points and exterior points based on a preset second distance threshold. When the first point-to-plane distance is less than the second distance threshold, the corresponding data point is recorded as an interior point; otherwise, it is recorded as an exterior point. Record the number of interior points until the set number of iterations is reached; The number of iterations is calculated according to a preset formula, which is: ; Where P is the preset confidence level, representing the probability of the occurrence of the inner points in the specified benign subset, ε is the estimated error rate of outliers in the point cloud data, and n is the number of the multiple data points selected each time.
[0012] By adopting the above technical solution, and introducing confidence level P and outlier error rate ε, the number of iterations M of the RANSAC algorithm is adaptively determined according to mathematical formulas. This avoids the problems of failing to find the correct model due to too few iterations or wasting computational resources due to too many iterations. Simultaneously, through interior point counting and multiple iterations for optimization, the selected initial model is ensured to have the most interior point support, laying a reliable foundation for subsequent fine-tuning.
[0013] Preferably, calculating the fitting deviation between the initial planar model parameters and all data points in the 3D point cloud dataset specifically includes the following steps: The fitting deviation is for each of the data points. The Euclidean distance to the plane defined by the current plane equation, i.e., the second point-to-plane distance. ; in, For the data points The three-dimensional point cloud coordinates.
[0014] By employing the above technical solution, the Euclidean distance from each data point to the current plane is calculated as the fitting deviation, providing a precise quantitative basis for subsequent weight allocation. This distance calculation method has a clear geometric meaning and can accurately reflect the degree of deviation between the data point and the current fitting plane, providing a reliable input parameter for the dynamic adjustment of adaptive weights.
[0015] Preferably, assigning contribution weights to each data point based on the fitting deviation specifically includes the following steps: Obtain the preset second distance threshold and the fitting deviation of the i-th data point, and determine the relationship between the fitting deviation of the i-th data point and the second distance threshold; When the fitting deviation corresponding to the i-th data point is less than or equal to the second distance threshold, a first contribution weight is assigned to the i-th data point; When the fitting deviation is greater than the second distance threshold, a second contribution weight is assigned to the i-th data point, and the second contribution weight is 0. The first contribution weight is negatively correlated with the fitting deviation, and the first contribution weight is greater than 0.
[0016] By employing the above technical solution, and comparing the fitting deviation with a preset threshold, differentiated processing of data points is achieved: in-place points are assigned higher weights to retain their contribution, while out-of-place points are assigned decreasing weights to suppress their negative impact. This allows for more precise utilization of data information, avoids information loss due to improper threshold settings, and thus improves fitting accuracy.
[0017] Preferably, the step of updating the initial planar model parameters using a weighted optimization method based on the contribution weights to obtain the updated planar model parameters specifically includes: The objective function is to minimize the weighted sum of the contribution weights of all the data points and the squared distance between the second point and the surface. A weighted least squares plane fitting objective function is then constructed. The weighted least squares objective function is solved to obtain the updated planar model parameters.
[0018] By adopting the above technical solution, a weighted least squares function with the objective of minimizing the sum of squared weighted point-to-surface distances is constructed, organically combining adaptive weights with planar optimization. This optimization method inherits the advantages of the least squares method in terms of high computational efficiency and stable results, while suppressing the influence of noise and outliers through dynamic adjustment of weights, thus achieving a balance between noise resistance and accuracy.
[0019] Preferably, determining whether the initial planar model parameters and the updated planar model parameters satisfy a preset convergence condition specifically includes the following steps: Calculate the angle between the normal vectors of the planes corresponding to the updated planar model parameters and the initial planar model parameters before the update; When the included angle of the normal vectors is less than a preset angle threshold, it is determined that the preset convergence condition is met; When the number of iterations reaches the preset maximum number of iterations, the iteration is terminated and the convergence condition is determined to be met.
[0020] By employing the above technical solution, and using the angle between the normal vectors of the planes before and after the update as the convergence criterion, the geometric proximity between the two planes can be reflected more intuitively and accurately compared to directly comparing parameter numerical differences. Furthermore, setting dual termination conditions—an angle threshold and a maximum number of iterations—ensures both fitting accuracy and avoids infinite loops, achieving a balance between accuracy and efficiency.
[0021] Secondly, this application provides a single-plane fitting optimization system based on adaptive weights, employing the following technical solution: The initial model generation module is used to acquire a 3D point cloud dataset, select multiple data points from the 3D point cloud data as candidate points based on preset geometric screening conditions, and generate initial plane model parameters based on the candidate points. The initial plane model parameters are used to define the plane equation. The weight allocation module is used to calculate the fitting deviation between the initial planar model parameters and all the data points in the 3D point cloud dataset, and to assign a contribution weight to each data point based on the fitting deviation, wherein the contribution weight is negatively correlated with the fitting deviation. The model update module is used to update the initial planar model parameters based on the contribution weights using a weighted optimization method, so as to obtain the updated planar model parameters. The convergence judgment module is used to determine whether the initial planar model parameters and the updated planar model parameters meet the preset convergence conditions. If the condition is not met, iterate until the convergence condition is met; if the convergence condition is met, output the updated planar model parameters as the fitting result.
[0022] By adopting the above technical solution, and modularizing the methodology into an initial model generation module, a weight allocation module, a model update module, and a convergence judgment module, a clear division of labor and collaborative work among the functional units are achieved. Modular design facilitates algorithm deployment and engineering implementation; each module can be independently optimized or replaced, improving the practicality and scalability of the technical solution.
[0023] Thirdly, this application provides a smart terminal, which adopts the following technical solution: A smart terminal includes a memory and a processor. The memory stores at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement the single-plane fitting optimization method based on adaptive weights as described above.
[0024] Fourthly, this application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the single-plane fitting optimization method based on adaptive weights as described above.
[0025] In summary, this application includes at least one of the following beneficial technical effects: (1) This invention improves the two-stage collaborative mechanism of RANSAC coarse fitting and adaptive weight iterative fine optimization. The first stage obtains a robust initial model, and the second stage refines it step by step through dynamic weights. It can still maintain sub-pixel level fitting accuracy in high noise and high outlier scenarios, thus solving the problem that traditional algorithms cannot balance noise resistance and accuracy. (2) The present invention uses a soft weighting mechanism to replace the traditional binary hard classification of RANSAC. It dynamically allocates continuous weights based on the distance from the point to the plane. Inner points retain high contributions, while outer points decrease but are not completely excluded. This fully utilizes the information of all data points and avoids information loss due to improper threshold settings. (3) The present invention constructs a closed-loop iterative structure of model update, weight allocation and re-update, and achieves adaptive convergence through the dual conditions of normal vector angle threshold and maximum number of iterations. It does not require manual intervention, and has high precision, high efficiency and high stability. It is suitable for scenarios with strict real-time requirements such as industrial automation detection. Attached Figure Description
[0026] Figure 1 This is a flowchart of the method in this embodiment; Figure 2 This is the system architecture diagram of this embodiment. Detailed Implementation
[0027] This application provides a single-plane fitting optimization method, system, terminal, and storage medium based on adaptive weights. To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be further described in detail below. An embodiment of a single-plane fitting optimization method based on adaptive weights of this application will be further described in detail below with reference to the accompanying drawings.
[0028] An adaptive weight-based single-plane fitting optimization method is applied to 3D point cloud data processing scenarios, such as flatness measurement and step difference detection in industrial inspection. The process is as follows: Figure 1 As shown: S1. Obtain a 3D point cloud dataset. Based on preset geometric filtering conditions, select multiple data points from the 3D point cloud data as candidate points. Generate initial plane model parameters based on the candidate points. The initial plane model parameters are used to define the plane equations. This includes the following steps.
[0029] First, obtain the 3D point cloud dataset P={p1,p2,…,p N}, where p i =(x i ,y i ,z i Let be the 3D coordinates of the i-th data point, and N be the total number of data points. 3D point cloud data can be acquired using devices such as 3D scanners, depth cameras, or LiDAR.
[0030] This embodiment uses an improved Random Sample Consensus (RANSAC) algorithm to generate initial planar model parameters.
[0031] Multiple data points are randomly selected from the 3D point cloud dataset to determine whether the multiple data points are collinear; in this embodiment, three data points are selected.
[0032] The method for determining non-collinearity is as follows: calculate the cross product of two vectors formed by the three points. If the magnitude of the cross product is greater than a set threshold, then the vectors are considered non-collinear. The threshold can be adjusted, such as 10. -6 .
[0033] If the data points are collinear, they are reselected; if they are not collinear, the distance between any two data points is calculated. If all the distances between the two data points are greater than the preset first distance threshold (set to 0.5mm in this embodiment), the data points are determined as candidate points.
[0034] Let the three data points be p1, p2, and p3, then the distance constraint is: ; ; ; If the above conditions are met, these three data points are determined as candidate points; if not, three data points are randomly selected again until the conditions are met or the preset number of attempts is reached.
[0035] Based on candidate points, the initial plane model parameters are calculated using the three-point plane equation. Let the initial plane model parameters be... The initial planar model parameters satisfy the plane equations ,and .
[0036] Specifically, let the candidate points be p1(x1,y1,z1), p2(x2,y2,z2), and p3(x3,y3,z3). Then the plane parameters can be calculated in the following way: First, calculate the two direction vectors formed by the above three points: ; ; Then calculate the normal vector: ; Normalize the normal vector so that Then calculate: ; Substitute the initial planar model parameters into the following formula to calculate the distance from all data points in the 3D point cloud dataset to the first point of the plane defined by the planar model parameters. ; The data points are classified into inner points and outer points by combining the preset second distance threshold (set to 0.05mm in this embodiment). When the distance between the first point and the surface is less than the second distance threshold, the corresponding data point is recorded as an inner point; otherwise, it is recorded as an outer point.
[0037] Record the number of interior points, and repeat the above steps until the set number of iterations is reached; The number of iterations is calculated based on a preset formula, which is: ; Where P is the preset confidence level (e.g., 0.99), representing the probability of points appearing in the specified benign subset; ε is the estimated error rate of outliers in the point cloud data, which is the error rate of outliers in the given point cloud data, and can be determined according to the distribution of the data samples (5% in this embodiment); n is the number of multiple data points selected each time (n=3 in this embodiment), so the calculation shows that the number of iterations in this embodiment is at least 3.
[0038] Therefore, the number of iterations is set to at least 3 (the number of iterations can be set to a larger number), the number of interior points in each iteration is recorded, and the initial plane with the most interior points is selected as the final initial plane model parameter.
[0039] Furthermore, in order to improve the robustness of the initial planar model in scenarios with uneven point cloud density, the preset second distance threshold in the above steps can be dynamically adjusted according to the currently randomly selected candidate point set.
[0040] Specifically, the variance of the point cloud distribution in the local region where the current candidate point set is located is calculated. And adjust the second distance threshold to: ; in, The preset base threshold (e.g., 0.05mm) is the original second distance threshold, and 'a' is the adjustment coefficient.
[0041] This dynamic mechanism avoids introducing too much noise in dense point cloud regions due to excessively high thresholds, or losing effective interior points in sparse regions due to excessively low thresholds, thus providing a higher-quality initial interior point set for subsequent weighted optimization.
[0042] Specifically, the determination of the local region where the current candidate point set is located and the variance σ of the point cloud distribution. 2 The calculation can be performed in the following way: Using the geometric center point p of the three randomly selected candidate points as an example c (x c ,y c ,z c Centered on the point cloud, a spatial cube (or a sphere with radius R) with side length L is defined as its local neighborhood. The side length L or radius R can be preset according to the average density of the point cloud or an empirical value. For example, L can be taken as 5%-10% of the average side length of the point cloud bounding box.
[0043] Extract all data points located within this cube (or sphere) from the 3D point cloud dataset P to form a local point set. .
[0044] Calculate the distance from all points in the local point set to the center point p. c The variance of the Euclidean distance is used as the variance σ of the point cloud distribution. 2 Its calculation formula is, ; in, p represents the number of local point clusters. j Let be any point in the point cloud set P; μ is the mean of all distances, representing the average spatial dispersion of the local point set relative to the center point. .
[0045] Construct an iterative optimization closed loop, and execute the following steps sequentially until the preset convergence condition is met: S2. Calculate the fitting deviation between the initial planar model parameters and all data points in the 3D point cloud dataset. Assign a contribution weight to each data point based on the fitting deviation. The contribution weight is negatively correlated with the fitting deviation.
[0046] Fit bias per data point The Euclidean distance to the plane defined by the current plane equation, i.e., the second point-to-plane distance. ; in, For data points The 3D point cloud coordinates (A,B,C,D) are the parameters of the planar model.
[0047] Obtain the preset second distance threshold and the fitting deviation of the i-th data point, and determine the relationship between the fitting deviation of the i-th data point and the second distance threshold; When the fitting deviation corresponding to the i-th data point is less than or equal to the second distance threshold, the data point is an inlier and the first contribution weight is assigned to the i-th data point. When the fitting deviation is greater than the second distance threshold, the data point is considered an outlier, and a second contribution weight is assigned to the i-th data point, with the second contribution weight being 0.
[0048] The first contribution weight is negatively correlated with the fitting bias, and the first contribution weight is greater than 0.
[0049] In this embodiment, the weighting function adopts a piecewise function form: ; Among them, distance variable The distance from the point to the plane is the second point-to-plane distance defined earlier, and t is the second distance threshold.
[0050] Specifically, in this embodiment, when the distance between the second point and the surface is less than or equal to the second distance threshold (the data point is an interior point): If the distance between the second point and the plane is 0, and the point lies entirely on the plane, then the weight function w i =1 (maximum weight, maximum contribution); If the distance between the second point and the surface is 0.025mm, which falls within the half-threshold, then the weighting function w i =0.5625 (medium weight); If the distance between the second point and the surface is 0.05mm, and it falls within the threshold boundary, then the weighting function w i =0 (closest to the outside point, minimum contribution).
[0051] When the distance between the second point and the surface is greater than the second distance threshold (the data point is an outside point), the second contribution weight w is assigned. i =0, completely eliminating the interference of outliers on model updates.
[0052] The plane parameters are continuously optimized and the weight coefficient of each point is recalculated through the above iterations.
[0053] This weighting method embodies the core idea of adaptive weighting, which is that the closer a point is to the plane, the greater its contribution.
[0054] In another specific implementation, after the weight allocation step and before the model update step, the following steps are included to enhance stability: Maintain a historical state record H for each data point i If the current point is determined to be an outside point, its historical state record is decremented by 1 (with a lower limit of 0); if it is determined to be an inside point, its historical state record is incremented by 1 (with an upper limit).
[0055] The final weights w participating in the weighted least squares calculation i_final for: w i_final =w×(1-α×H i (When it is an exterior point) or w i_final =w i ×(1+β×H i (When it is an interior point); Where α and β are the attenuation and enhancement coefficients, respectively. The attenuation coefficient α can be set to 0.1, and the enhancement coefficient β can be set to 0.05. H i The upper limit for increasing or decreasing the value can be set to 5. Those skilled in the art can adjust these parameters according to the requirements for the algorithm's convergence speed and stability.
[0056] This mechanism effectively avoids repeated oscillations at edge points during iteration by introducing state memory in the time dimension, accelerates the convergence of the algorithm, and improves the stability of the final fitted plane.
[0057] S3. Based on the contribution weights, the initial planar model parameters are updated using a weighted optimization method to obtain the updated planar model parameters.
[0058] The objective function for weighted least squares plane fitting is constructed with the goal of minimizing the weighted sum of the contribution weights of all data points and the squared distance between the second point and the plane. The weighted least squares objective function is solved to obtain the updated planar model parameters.
[0059] In this embodiment, the objective function for weighted least squares plane fitting is: ; Where N is the total number of data points in the 3D point cloud dataset, w i Let (k,m,b) be the contribution weight for the i-th data point, and let (k,m,b) be the parameters of the plane model, which satisfy the transformation relationship with the standard plane equation parameters (A,B,C,D): ; ; ; ; when At that time, from the plane equation, we can obtain, ; Therefore, the vertical distance from each data point to the plane is defined as , .
[0060] By taking the partial derivatives of k, m, and b with respect to A, B, C, and D respectively and setting them to zero, we obtain the system of equations: ; Solving the above system of equations yields the model parameters (k,m,b), which in turn leads to the updated model. .
[0061] S4. Determine whether the initial and updated planar model parameters meet the preset convergence conditions; if not, iterate until the convergence conditions are met; if the convergence conditions are met, output the updated planar model parameters as the fitting result. Specifically: Calculate the updated planar model parameters Compared with the initial planar model parameters before the update The angle between the normal vectors of the corresponding plane; ; When Δθ is less than the preset angle threshold θth (0.01 radians in this embodiment), the convergence condition is met and the iteration is terminated.
[0062] When the number of iterations reaches the preset maximum number of iterations M max When (for example, 50 iterations) are taken, the iteration is terminated and the convergence condition is determined.
[0063] Output the final planar model parameters (A) that satisfy the convergence condition. final B final C final D final This is used as the fitting result. The plane parameters can be used for subsequent industrial inspection applications, such as calculating flatness and step difference.
[0064] In another specific implementation, after outputting the fitting results, the method further includes an industrial detection adaptation step: Based on the final determined planar model and interior point set, calculate the distribution statistics of all interior point residuals, such as the 95th quantile and the 99th quantile. The 95th (or 99%) quantile is calculated by sorting the absolute values of all interior point residuals from smallest to largest, and taking the residual value located at the 95th (or 99th) position after sorting as the planarity of that quantile.
[0065] Based on industrial testing standards (such as ISO 12780), it automatically generates flatness reports corresponding to different confidence levels, such as 95% confidence level and 99% confidence level, and marks high-risk data point areas with residuals greater than 3 times the standard deviation.
[0066] The above method not only outputs geometric parameters, but also directly outputs quantitative evaluation indicators that meet quality control standards, achieving a seamless connection from geometric fitting to industrial quality inspection.
[0067] Based on the same inventive concept described above, this application also discloses an adaptive weighted single-plane fitting optimization system, the architecture of which is as follows: Figure 2 As shown, it includes the following modules: The initial model generation module is used to acquire a 3D point cloud dataset, select multiple data points from the 3D point cloud data as candidate points based on preset geometric screening conditions, and generate initial plane model parameters based on the candidate points. The initial plane model parameters are used to define the plane equation. The weight allocation module is used to calculate the fitting deviation between the initial planar model parameters and all data points in the 3D point cloud dataset. Based on the fitting deviation, a contribution weight is assigned to each data point, and the contribution weight is negatively correlated with the fitting deviation. The model update module is used to update the initial planar model parameters based on the contribution weights using a weighted optimization method, so as to obtain the updated planar model parameters. The convergence judgment module is used to determine whether the initial plane model parameters and the updated plane model parameters meet the preset convergence conditions. If the condition is not met, iterate until the convergence condition is met; if the convergence condition is met, output the updated planar model parameters as the fitting result.
[0068] Based on the same inventive concept described above, this application also discloses a smart terminal, including a memory and a processor. The memory stores at least one instruction, at least one program, code set, or instruction set. The processor loads and executes the at least one instruction, at least one program, code set, or instruction set to implement the adaptive weight single-plane fitting optimization method described above.
[0069] Based on the same inventive concept described above, this application also discloses a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the adaptive weight single-plane fitting optimization method described above.
[0070] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media capable of storing program code.
[0071] The above are merely optional embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A single-plane fitting optimization method based on adaptive weights, characterized in that, Includes the following steps: A three-dimensional point cloud dataset is acquired, and multiple data points are selected from the three-dimensional point cloud data as candidate points based on preset geometric filtering conditions. Initial plane model parameters are generated based on the candidate points, and the initial plane model parameters are used to define the plane equation. An iterative optimization closed loop is constructed, and the iterative optimization closed loop executes the following steps sequentially until a preset convergence condition is met. Calculate the fitting deviation between the initial planar model parameters and all the data points in the 3D point cloud dataset, and assign a contribution weight to each data point based on the fitting deviation, wherein the contribution weight is negatively correlated with the fitting deviation; Based on the contribution weights, the initial planar model parameters are updated using a weighted optimization method to obtain the updated planar model parameters; Determine whether the initial planar model parameters and the updated planar model parameters satisfy the convergence condition; If the condition is not met, iterate until the convergence condition is met; if the convergence condition is met, output the updated planar model parameters as the fitting result.
2. The single-plane fitting optimization method based on adaptive weights according to claim 1, characterized in that, The process of acquiring a 3D point cloud dataset, selecting multiple data points as candidate points from the 3D point cloud data based on preset geometric filtering conditions, and generating initial planar model parameters based on the candidate points, specifically includes the following steps: Obtain a 3D point cloud dataset, randomly select multiple data points from the 3D point cloud dataset, and determine whether the multiple data points are collinear; If they are not collinear, calculate the distance between any two data points among the plurality of data points. If all the distances between the two points are greater than a preset first distance threshold, then the plurality of data points are determined as candidate points. Based on the candidate points, the initial plane model parameters are calculated using the three-point plane equation. The initial plane model parameters satisfy the plane equation. ,and .
3. The single-plane fitting optimization method based on adaptive weights according to claim 2, characterized in that, The step of calculating the initial plane model parameters based on the candidate points using the three-point plane equation specifically includes the following steps: Calculate the first point-to-plane distance from all data points in the 3D point cloud dataset to the plane defined by the plane model parameters, and classify the data points into interior points and exterior points based on a preset second distance threshold. When the first point-to-plane distance is less than the second distance threshold, the corresponding data point is recorded as an interior point; otherwise, it is recorded as an exterior point. Record the number of interior points until the set number of iterations is reached; The number of iterations is calculated according to a preset formula, which is: ; Where P is the preset confidence level, representing the probability of the occurrence of the inner points in the specified benign subset, ε is the estimated error rate of outliers in the point cloud data, and n is the number of the multiple data points selected each time.
4. The single-plane fitting optimization method based on adaptive weights according to claim 1, characterized in that, The calculation of the fitting deviation between the initial planar model parameters and all data points in the 3D point cloud dataset specifically includes the following steps: The fitting deviation is for each of the data points. The Euclidean distance to the plane defined by the current plane equation, i.e., the second point-to-plane distance. ; in, For the data points The three-dimensional point cloud coordinates.
5. The single-plane fitting optimization method based on adaptive weights according to claim 3, characterized in that, The step of assigning contribution weights to each data point based on the fitting deviation specifically includes the following steps: Obtain the preset second distance threshold and the fitting deviation of the i-th data point, and determine the relationship between the fitting deviation of the i-th data point and the second distance threshold; When the fitting deviation corresponding to the i-th data point is less than or equal to the second distance threshold, a first contribution weight is assigned to the i-th data point; When the fitting deviation is greater than the second distance threshold, a second contribution weight is assigned to the i-th data point, and the second contribution weight is 0. The first contribution weight is negatively correlated with the fitting deviation, and the first contribution weight is greater than 0.
6. The single-plane fitting optimization method based on adaptive weights according to claim 4, characterized in that, The step of updating the initial planar model parameters based on the contribution weights using a weighted optimization method to obtain the updated planar model parameters specifically includes: The objective function is to minimize the weighted sum of the contribution weights of all the data points and the squared distance between the second point and the surface. A weighted least squares plane fitting objective function is then constructed. The weighted least squares objective function is solved to obtain the updated planar model parameters.
7. The single-plane fitting optimization method based on adaptive weights according to claim 1, characterized in that, The step of determining whether the initial planar model parameters and the updated planar model parameters satisfy the preset convergence condition specifically includes the following steps: Calculate the angle between the normal vectors of the planes corresponding to the updated planar model parameters and the initial planar model parameters before the update; When the included angle of the normal vectors is less than a preset angle threshold, it is determined that the preset convergence condition is met; When the number of iterations reaches the preset maximum number of iterations, the iteration is terminated and the convergence condition is determined to be met.
8. A single-plane fitting optimization system based on adaptive weights, characterized in that, Includes the following modules: The initial model generation module is used to acquire a 3D point cloud dataset, select multiple data points from the 3D point cloud data as candidate points based on preset geometric screening conditions, and generate initial plane model parameters based on the candidate points. The initial plane model parameters are used to define the plane equation. The weight allocation module is used to calculate the fitting deviation between the initial planar model parameters and all the data points in the 3D point cloud dataset, and to assign a contribution weight to each data point based on the fitting deviation, wherein the contribution weight is negatively correlated with the fitting deviation. The model update module is used to update the initial planar model parameters based on the contribution weights using a weighted optimization method, so as to obtain the updated planar model parameters. The convergence judgment module is used to determine whether the initial planar model parameters and the updated planar model parameters meet the preset convergence conditions. If the condition is not met, iterate until the convergence condition is met; if the convergence condition is met, output the updated planar model parameters as the fitting result.
9. A smart terminal, characterized in that, The system includes a memory and a processor, wherein the memory stores at least one instruction, at least one program, code set, or instruction set, and the at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement the single-plane fitting optimization method based on adaptive weights as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The readable storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the single-plane fitting optimization method based on adaptive weights as described in any one of claims 1 to 7.