In this paper we present a technique to measure the crater wear using image processing and automatic focusing. The new contour detection algorithm, which can adapt in a noisy image, is suggested. It is suitable for eliminating high frequency noises without blurring and with lower processing time. 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 servo motor. The results show that the contour and the depth of crater wear can be measured reliably.