Subtracting the background of the image by the polynomial function based on the Least Square-Fit was put forward. The influence of the background being on the characteristic was reduced by the subtracting. Then,according to the structure of the workpiece,the texture was first removed in order to make the gray level even. At last,following normal distribution of the signal of the digital image,a threshold was set to make the characteristic apart.