Abstract:Taking the standard gauge block as the experimental object, to address the problems that the chamfer features of the parts are prone to wide edges in the parts image under the illumination of ring light source, and the inaccurate image focusing is caused by manual focusing, which lacks the objectivity of camera focusing, etc. , a high-precision focusing method of parts image based on improved gradient weighting is proposed. Firstly, the illumination method of the strip light source arranged at a 45-degree angle is adopted to eliminate the wide edges of the chamfer features in the parts image. Secondly, the feature edge points of image are extracted by the adaptive segmentation threshold based on the improved Otsu. Then, the gradient values of edge pixels are obtained based on the 4- direction Sobel operator. Then, according to the grayscale distribution difference between the pixel and its 8 neighboring pixels, the gradient weighting coefficient of the pixel is obtained. Finally, the sharpness evaluation of image is completed by the improved function of gradient-weighted focus evaluation, thus, the accurate focus image is obtained and the high-precision measurement of size is realized. The experimental results show that the proposed method is more accurate than the traditional high-precision measurement method, and the relative error with the manual measurement is less than 0. 002 4%. The improved focus evaluation function in this paper is improved by 75 times in sharpness ratio, 5 times in sensitivity factor and double in steepness on average compared with the traditional evaluation functions