Abstract:During the multi-pin docking and assembly process of connectors, if the precise position and orientation of parts cannot be accurately detected, it is very likely to lead to the failure of the connector docking task, and even cause pin bending or damage to the part structure. However, due to the interference of factors such as image noise, machining marks inside holes, defocus caused by hole depth, and hole wall shadows, it is difficult to accurately obtain a complete and precise circular contour when detecting holes, which has a relatively significant negative impact on the accuracy of connector pose detection. In response to the above problems,this paper proposes an improved circle fitting algorithm based on RANSAC. Firstly, coarse positioning is carried out through the Hough gradient method, and then the inlier set of the circle to be fitted is obtained through RANSAC. Finally, the WLS method, which determines weights according to the relative number of inliers in the neighborhood, is proposed to refit the circle for the inlier set, and then the precise pose of the connector is calculated. This paper also conducts a precision test experiment. The measured average attitude error is 0.051°, and the average position error is 0.567 pixels. Compared with other common algorithms, it is finally verified that the algorithm in this paper has high accuracy and stability, and the detection effect is better than that of other algorithms.