Luminous Landscape Forum
Raw & Post Processing, Printing => Digital Image Processing => Topic started by: Guillermo Luijk on July 28, 2011, 01:21:13 pm
-
Focus Peaking (http://www.youtube.com/watch?v=HGPF375-2rA) 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:
(http://img40.imageshack.us/img40/4028/escena.jpg)
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):
(http://img94.imageshack.us/img94/38/kernel.gif)
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:
(http://www.guillermoluijk.com/misc/escena1.gif)
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:
(http://img856.imageshack.us/img856/228/escena2.gif)
(http://img200.imageshack.us/img200/6527/escena2s.jpg)
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:
(http://img691.imageshack.us/img691/4618/florgq.jpg)
Would result in the following focus display:
(http://www.guillermoluijk.com/misc/flor.gif)
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
Regards
-
> NEX
I think that it is used in video cams for years already, right ? so it is not not like Panasonic for example did not implement it before.
-
I think that it is used in video cams for years already, right ?
Correct. It's been in use for the best part of forty years on broadcast cameras, possible more.
Coloured peaking is horrible and not worth bothering with. Well set up white is easiest to use.
The latest Sony HD broadcast cameras like the HDC1500 and viewfinders like the HD75Vf have something like a dozen different parameters to configure to control peaking performance.
-
Beautiful demo, Guillermo. Thanks for posting it.
Eric
-
Very interesting! Would it be possible to set this proceedure up as an action in Photoshop?
Mike
-
Very interesting! Would it be possible to set this proceedure up as an action in Photoshop?
I guess it is (I do not know much about PS actions though). However I don't think this would be of much interest. I used Photoshop just for illustration purposes, but the point of these techniques is to be applied while focusing on the camera, implemented in their firmware.
Another example, now with false positive detection: the filter detected microcontrast in the window in the background although it was in an out of focus area. This was because the strong difference in luminance window glass vs window frame.
(http://www.guillermoluijk.com/misc/fpcerny.gif)
(http://www.guillermoluijk.com/misc/fpcerny.jpg)
I used the RAW blue channel (no demosaicing).
-
And another example, specially propicious to work fine (high contrast text and drawings):
Lines in edges:
(http://www.guillermoluijk.com/misc/libro1.gif)
Or with zones:
(http://www.guillermoluijk.com/misc/libro2.gif)
which style would you prefer on your camera?
Regards
-
Would perhaps be neat to use in a micro-adjustement tool?
"Take an image of this print, and see immidiately where the focus lies. Add/detract some amount from the MA in the camera, and repeat..."
-h
-
Brilliant as usual!
For me, I'd like the edges display a bit better than the zone one - eg in intricate views, like when the AF hunts for the bird in the middle of a tree, the zone display may not be as useful.
-
I was thinking that this would be a way to imitate the focus function in Capture one that allows one to see where the sharp areas are on a captured image. I take numerous shots of each scene and vary the way I focus each one so I found it illustrative to use this function in C1 to see which image has the best focus.
-
Very interesting ... and nearly no answers
many thanks
-
Thanks for providing this good info.
-
There is an interesting post at http://www.petapixel.com/2012/10/25/olympus-om-d-em-5s-art-filter-works-nicely-as-a-focus-peaking-feature/ (http://www.petapixel.com/2012/10/25/olympus-om-d-em-5s-art-filter-works-nicely-as-a-focus-peaking-feature/) explaining how to use the 'Fine Art' mode of an Olympus m43 camera to create a focus peeking effect. It seems to work in the video.
I have a GH2. I'll have to try the various art modes and see if any of them can do the same trick. If I could get it to work, it would be very useful when using manual focus lenses.
-
Thank you for such a great demo!
-
Wow, this is an awesome technique! I've used the High Pass Filter for softening skin tones & to add contrast to portraits, but never for "Focus Peaking"... I'm going to try it on some shots from last weekend's wedding. Thanks for sharing!
-
Guillermo:
Excellent presentation (and as usual, your posts are always interesting, educational and useful).
Now I'm wondering; if this has been used for years in video, why haven't we had it in our DSLR's?
The outline version would be very useful in macro work, particularly if the colour could be changed to suit the object.
White might be the best option for many subjects, but not of much use for a white flower for example (or a bride in white!).
Glenn
-
The sony a99 allows you to do focus peaking in one of three colur choices. Red, Yellow and White
Pierre
-
Magic Lantern provides focus peaking for Canon cameras plus a lot of other goodies and most excitingly an adaption inspired by Guillermo's "Zero Noise" in a single shot with alternating rows ISO amplified at different gains.
-
Now I'm wondering; if this has been used for years in video, why haven't we had it in our DSLR's?
It's not something that is achievable through an optical view finder for starters. Sony has had it in their DSLT cameras for a while.
I use it all the time with my A99.
-
It's not something that is achievable through an optical view finder for starters. Sony has had it in their DSLT cameras for a while.
I use it all the time with my A99.
I should have been more specific - why not available in LV?
-
Very interesting. Thank you.
-
RawTherapee also features Focus Mask functionality, the algorithm there is a bit different - it is based on analysis of standard deviation of image details on two different scales.