We take it for granted, but the human ability to focus instantly on particular objects in our field of vision, near or far, is a remarkable skill. As camera manufacturers have learned, it is not easy to replicate artificially. Even the most advanced digital cameras use autofocus mechanisms that are far from perfect. But now two US scientists have developed a simple algorithm that looks set to revolutionise the way autofocus works, allowing for greater speed and accuracy in digital photography.

The development emerged from a study of the human eye. Johannes Burge, a postdoctoral researcher at the University of Texas and his adviser Wilson Geisler wanted to understand how our eyes are able to focus so much more efficiently than a digital camera.

Most autofocus mechanisms, Burge tells me, use contrast levels to determine how in or out of focus an image is. "The camera computes the contrast of an image, changes the distance that the lens is focused and computes the contrast again. If the contrast is higher, the camera knows it's going in the correct direction." This process of guessing and checking continues until the contrast is highest. It takes time and uses up battery power, says Burge, "and it also rests on the false assumption that best contrast equals best focus".

A second autofocus system called phase detection, used by higher-end cameras, is more accurate, Burge adds, but it has problems of its own: for one, it relies on bulky and expensive hardware.

The system developed by Burge and Geisler requires no before-and-after comparison, and could be incorporated into a simple point-and-shoot camera. It works by taking an inventory of the features in a scene. In their study, published in the Proceedings of the National Academy of Sciences, they found that humans and other animals extract key features from a blurry image and use that information to work out their distance from an object. Then the eye focuses accordingly.

"Many small predatory animals use 'defocus' as their primary depth cue," says Burge. "When a chameleon tracks a fly with its eye, there are muscles in the back of the eye that determine what the focus distance is."

Burge and Geisler's breakthrough is based on the same principle. Using well known mathematical equations, they created a computer simulation of the human visual system. When the simulation was presented with real photographs of scenes from nature, even though the images varied widely, the patterns of focus remained the same.

The algorithm hasn't been tested in an actual camera yet, but Burge is confident that it will work – and have applications in other areas too, such as neuroscience. The pair are applying for a patent on the technology and they've already had interest from a major electronic imaging company. Later this month, they will be presenting their work at a International Society for Optics and Photonics conference in San Francisco. If their work follows through to the marketplace, a future generation of digital cameras may be able to focus accurately in as few as 10 milliseconds.

This article was amended on 17/1/12 to link to the correct PNAS article