is a real time facility of current Sony mirrorless NEX cameras that shows the user the areas in focus in the scene currently being displayed. To illustrate how 'Focus Peaking' works I tried to reproduce the process in Photoshop. It is quite simple, so I see no reason why any mirrorless camera could not implement it.
To detect in-focus areas in an image is just a matter of detecting microcontrast (i.e. fine detail), something these cameras already need to do in their AF system.
Starting from any real time capture:
The simplest way to detect microcontrast is through a high pass filter
(HPF). In the areas in focus, the detail will trigger a threshold set in the HPF, while out of focus areas wont's do so for being totally blurred in terms of high spatial frequencies.
I desaturated the previous image (this makes things simpler, but it's in fact the way to work on undemosaiced data) and applied a simple HPF inside Photoshop (Filter -> Others -> Custom):
By applying an adequate boolean threshold over the result of this filtering, we can detect the borders in focused areas, and this information can be overlayed on the original image as NEX cameras do. Out of focus areas were very far from reaching the HPF output threshold:
Only the borders of in-focus areas are marked since we are strictly detecting microcontrast (a plain colour area won't display any microcontrast, no matter if it is in focus or not). But perhaps for the photographer it is more adequate to see areas in focus
rather than borders or isolated pixels, like Capture One does for instance. These areas can be displayed over the image without needing to animate. So we could have a real time view of the scene of this kind:
We determined that in the neighbourhood of the pixels in focus, there should exist some area in focus of a reasonable radius of influence. This over simplified algorithm can be improved a lot, but the concept remains clear.
Another example here:
Would result in the following focus display:
Adjustable parameters for the Focus Peaking would be needed to control sensitivity (according to aperture used, sharpness of the lens,...):
- HPF (more complex kernels can be used)
- Detection threshold applied to HPF output
- Radius of influence to determine the areas in focus in the second type of view
- Cleaning of false focused pixels (in the first image, some pixels are classified as focused in the pitcher; or that's the referee?), useful for instante in noisy images