1. A system for merging differently focused images, the system comprising a measuring machine and a computer for obtaining a plurality of the differently focused images of an object disposed on the measuring machine, the computer comprising a merge images program, the merge images program comprising a read module, a determining module, and a merge images module, wherein: the read module is configured for reading the plurality of the differently focused images of the object disposed on the measuring machine, selecting an image of the plurality of the differently focused images as a first image, selecting another image of the plurality of the differently focused images as a next image, reading gray values of the pixels and computing a gradient of each pixel according to the gray values; the determining module is configured for determining whether the gradient of each of the pixels of the first image is less than the gradient of a corresponding pixel of the next image, determining whether the next image is a last image, and determining whether the read pixel is a last pixel of the first image; the merge images module is configured for updating/replacing the gray value and the gradient of the pixel of the first image with the gray value and the gradient of the corresponding pixel of the next image if the gradient of the pixel of the first image is less than the gradient of the corresponding pixel of the next image; and keeping the gray value and the gradient of the pixel of the first image if the gradient of the pixel in the first image is greater than or equals to the gradient of the corresponding pixel in the next image; thereby obtaining a merged image.