The same hardware components are used for autofocus as for image processing. When the sensor is moved along the optical axis, a sharply defined image results only in a single position. If the sensor is defocused, blurred images are produced. The contrast can be used as a parameter for the focus of an image. If the sensor is moved along its optical axis within a range which contains the object plane, the contrast reaches its maximum value at the point where the focal plane coincides with the object plane. The location of the point on the surface can be determined from this sensor position (Fig. 14a). Focusing can then be performed by positioning to this point.

The sensitivity of the described procedure is primarily influenced by the magnitude of the range along the optical axis that is apparently displayed sharply by the lens used. This range, commonly referred to as ‘depth of field’, is directly dependent on the resolution and the numerical aperture of the lens used. Selection of a higher numerical aperture reduces the depth of field and increases the precision of the measurement taken with the autofocus. With conventional lenses, high magnifications yield the best results.

The chief disadvantage of the technique described above is that a certain range must be traversed along the optical axis. Several seconds per measured point are thus required in order to attain high accuracies. This time requirement is in direct contrast to the extremely high measuring speeds of image processing sensors, where several thousand points per second can be evaluated.

Faster distance measurement can be achieved using an autofocus technique in which three sensor chips are permanently mounted at various positions in the imaging beam path and combined to form a camera (Fig. 14b). As opposed to the autofocus technique described above, three points of the contrast-path curve can be determined simultaneously. The calculation of the contrast curve is performed based on these three points and the known principal parameters of the curve itself. The measuring frequency of this technique is thus limited by the frame rate of the image processing unit (to several tens of points per second).