Abstract:
An improved extraction algorithm integrating the geometric center method and the gray centroid method was proposed to address the limitation of conventional line-structured light extraction algorithms in balancing speed and accuracy. Firstly, threshold processing was applied to reduce the interference of low pixel values on centerline extraction. Subsequently, the image was bidirectionally scanned row by row to search and store the coordinates of the maximum pixel value. If the column coordinate difference in the current row was smaller than a set threshold, the geometric center method was employed to coarsely extract the stripe center; otherwise, the closest point to the center coordinate of the previous row was selected as the current row center based on distance calculation, enabling fast and accurate stripe localization. On this basis, an improved gray centroid method was applied within the neighborhood of the coarsely extracted coordinates to achieve sub-pixel precision extraction, which reduced computational load while improving accuracy. Finally, least squares fitting was used to further optimize the light stripe position, enhancing smoothness and continuity. The effectiveness of the proposed algorithm was verified through comparative experiments with traditional algorithms and 3D reconstruction.The results show that the proposed algorithm outperforms the comparison algorithms in terms of extraction accuracy (RMSE=1.081 pixel), operational efficiency (0.057 s), and reconstruction quality (0.122 mm), and can better preserve the geometric features of the workpiece, significantly exceeding the industrial error tolerance of 5 mm and meeting the high-precision industrial measurement requirements of sub-pixel level. This research provides an efficient and reliable solution for 3D visual inspection.