In the process of image acquisition, the lighting equipment can not uniformly cover the surface of the spur gear housing, and some spur gears will have defects such as grooves, resulting in uneven illumination of the spur gear, and the spur gear defect image has noise, so first use adaptive median filter to denoise the defect image containing noise, as shown in Figure.

The improved adaptive median filtering algorithm is used to detect the spur gear defect image. In order to verify the above effectiveness, the improved algorithm is compared with the average filtering, Wiener filtering and the original median filtering and other denoising processing algorithms. The results show that the proposed improved algorithm has less ambiguity on the boundary of the white spot area and the best processing effect.