View Full Version : Image processing: Focus point detection

02-09-2012, 07:31 PM
Someone just posed an interesting question to me, and this is the only place I hang out where anybody knows anything at all about image processing.

Given a digital photograph, how can I detect the area of sharpest focus?

02-09-2012, 08:59 PM
In theory, the part of the image with the sharpest focus would be the part of the image with the highest-frequency components (sharpest edges). But that metric would probably only hold in images with good hard edges and not lots of little bright things or too much shakiness. One way to find it using that technique would be to break the image down into as many blocks as you want (with a good edge falloff) and do an FFT on the blocks: the blocks with the most energy in the highest frequency areas is probably going to the sharpest focus. This technique would probably fail if there is a lot of texture in lower-focus areas and relatively little texture in the higher-focus areas, though.

There has been a lot of research the last few years on refocusing images and those papers have a fair amount of information that might be of interest. Check out the various SIGGRAPH papers for the last couple of years at http://kesen.realtimerendering.com/ for good discussions.