University of Texas at Austin researchers have discovered how to extract and use information in an individual image to determine how far objects are from the focus distance, a feat only accomplished by human and animal visual systems until now. Like a camera, the human eye has an auto-focusing system, but human auto-focusing rarely makes mistakes. And unlike a camera, humans do not require trial and error to focus an object.

A statistical algorithm can now determine focus error -- which indicates how much a lens needs to be refocused to make the image sharp -- from a single image without trial and error. The algorithm can be applied to any blurry image to determine focus error. An estimate of focus error also makes it possible to determine how far objects are from the focus distance.

In the human eye, inevitable defects in the lens, such as astigmatism, can help the visual system compute focus error; the defects enrich the pattern of "defocus blur," the blur that is caused when a lens is focused at the wrong distance. Humans use defocus blur to both estimate depth and refocus their eyes. Many small animals use defocus as their primary depth cue.

The researchers considered what happens to images as focus error increases: an increasing amount of detail is lost with larger errors. Then, even though the content of images varies considerably, the pattern and amount of detail in images is remarkably constant. This constancy makes it possible to determine the amount of defocus and, in turn, to re-focus appropriately.

Source