In this paper a new technique to measure the crater wear using image processing and automatic focusing is presented. The contour detection algorithm, which can adapt in a noisy image, is suggested. It is suitable for eliminating high frequency noises with lower processing time and without blurring. An automatic focusing technique is applied to measure a crater wear depth with a one-dimensional search algorithm for finding the best focus. This method is implemented in the tool microscope driven by a servomotor. the results show that the contour and depth of crater wear can be measured reliably.