1. A system for automatic focusing of images comprising a measure machine and a computer, the measure machine having a Z axis, the Z axis being installed with a Charged Coupled Device (CCD) and a motor, the computer being connected with the CCD by an image acquisition card and connected with the motor by a controlling card, the computer comprising: an inputting/outputting module for retrieving consecutive images of objects on the measure machine from the CCD, outputting instructions to the motor for controlling the Z axis to move within a predetermined focusing area, and outputting a focus location of the consecutive images; a parameter setting module for setting particular parameters required for focusing images, and setting a start location and an end location for the Z axis of the measure machine according to an approximate focus location and the predetermined focusing area; a calculating module for calculating definition values of the consecutive images and obtaining a corresponding focus location according to the definition values; and a determining module for determining whether the Z axis has arrived at the end location, and determining whether it is the second time to focus the images when the Z axis has arrived at the end location.