# A Linear Fitting Algorithm Based on Modified Random Sample Consensus
## 5 Conclusions  
This paper proposes an improved line fitting algorithm based on RANSAC. The LSH-based RANSAC algorithm combines the efficient similarity search capabilities of LSH with the robust fitting mechanism of RANSAC. This approach enables the rapid elimination of outliers in the data while accurately fitting the optimal model. The algorithm possesses the following characteristics: (1) Improved Fitting Accuracy. By introducing LSH, the algorithm utilizes the locality-sensitive nature of LSH to eliminate outliers before fitting, thereby reducing the impact of these outliers on the fitting results. (2) The algorithm further employs the iterative nature of RANSAC, selectively filtering inliers and outliers during each fitting iteration based on the model's adaptability, thereby progressively approximating the optimal model. (3) Enhanced Robustness. The locality-sensitive property of LSH also helps to filter out the influence of noise and outliers on the dataset, making the RANSAC algorithm more stable and reliable during the model fitting process. This enhancement allows the algorithm to better handle datasets containing noise and outliers, thereby increasing its applicability. Experimental results demonstrate that the proposed improved RANSAC line fitting algorithm significantly outperforms WLS, RANSAC, and MLE. When fitting simulation datasets, the fitted curve nearly coincided with the known line, and the Euclidean distance between the result parameters and the known standard parameters for the LSH-RANSAC algorithm was merely 0.089, far lower than that of the other three fitting algorithms. When fitting the real target dataset, the LSH-RANSAC algorithm shows substantial improvements across all three technical metrics compared to the other three algorithms. The research findings have been applied in a project focused on ultrathin thickness measurement of objects using modulation line lasers, yielding high measurement accuracy that meets the requirements and demonstrates substantial practical application value. Future work may further investigate the influence of different hash functions within the Local Sensitive Hashing framework on the processing of outcomes for various types of data, enhancing the algorithm's robustness. The LSH-RANSAC algorithm is proposed to handle a specific linear fitting scene with a two-dimensional database and low time sensitivity; thus, we do not validate the algorithm's performance on datasets with a high proportion of outliers, the execution times, nor the algorithm's effectiveness in higher dimensional spaces. Future research can be further developed based on the following aspects: (1) Investigate the algorithm's performance when there is a significant proportion of outliers in the dataset to figure out its effectiveness. (2) When handling data with high time sensitivity, analyze the algorithm's computational complexity and measure the execution time to ensure real-time processing requirements are met. (3) Validate the effectiveness of the algorithm when applied to high-dimensional data. (4) Study the impact of adjusting various parameters of the LSH algorithm on the results obtained for different types of data, aiming to further enhance the robustness of the algorithm. Conceptualization, F.Z. ; methodology, Y.M. ; software, H.C.; validation, Y.M. ; formal analysis, Y.T. ; investigation, Y.M. ; resources, Y.T. ; data curation, Y.M. ; writing--originaldraft preparation, Y.T. ; writing--review and editing, F.Z. ; visualization, F.Z. ; supervision, F.Z. ; project administration, Y.M. ; funding acquisition, F.Z. All authors have read and agreed to the published version of the manuscript. This research was funded by the National Natural Science Foundation of China OF FUNDER grant number 62001333. Not applicable. The data present in this study are available on request from the corresponding author. The data are not publicly available due to privacy.