The invention belongs to the technical field of vision measurement, in particular to an automatic focusing method. In the method, an idea, which comprises that an image definition evaluation function is designed on the basis of improved discrete cosine transformation (DCT) to represent detail information of the image and highlight high frequency energy, and the relative definition is brought in by consideration of a close relation between the definition of the image and the brightness and the gray scale of the image, is provided. Meanwhile, in the method, a scale-variable window selecting scheme is provided on the basis of analyzing the influence from the selection of a focusing window on a focusing result. Experimental results show that the effect of the improved image definition judgment is improved greatly; in the actual application of the method, a partial extreme value of the image definition judgment is hard to avoid, so, by combining return information of a lens, an improved climbing method search strategy of total-range rough adjustment large step length focusing and partial refine adjustment small step length focusing is provided; and in the method, a scheme of starting automatic focusing when a shooting scene is changed or the lens is zoomed is provided.