Ad
Ad
Ad
Pages: [1] 2 »   Bottom of Page
Print
Author Topic: How 'Focus Peaking' works  (Read 127076 times)
Guillermo Luijk
Sr. Member
****
Offline Offline

Posts: 1273



WWW
« on: July 28, 2011, 12:21:13 PM »
ReplyReply

Focus Peaking 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

Regards
« Last Edit: July 28, 2011, 12:47:51 PM by Guillermo Luijk » Logged

deejjjaaaa
Sr. Member
****
Offline Offline

Posts: 743


« Reply #1 on: July 28, 2011, 01:15:18 PM »
ReplyReply

> 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.
Logged
Rhossydd
Sr. Member
****
Offline Offline

Posts: 1888


WWW
« Reply #2 on: July 29, 2011, 12:28:34 AM »
ReplyReply

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.
Logged
Eric Myrvaagnes
Sr. Member
****
Offline Offline

Posts: 7789



WWW
« Reply #3 on: July 29, 2011, 09:32:32 AM »
ReplyReply

Beautiful demo, Guillermo. Thanks for posting it.

Eric
Logged

-Eric Myrvaagnes

http://myrvaagnes.com  Visit my website. New images each season.
Mike Sellers
Sr. Member
****
Offline Offline

Posts: 354


WWW
« Reply #4 on: July 31, 2011, 08:37:08 AM »
ReplyReply

Very interesting! Would it be possible to set this proceedure up as an action in Photoshop?
Mike
Logged
Guillermo Luijk
Sr. Member
****
Offline Offline

Posts: 1273



WWW
« Reply #5 on: July 31, 2011, 08:54:14 AM »
ReplyReply

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.






I used the RAW blue channel (no demosaicing).

Logged

Guillermo Luijk
Sr. Member
****
Offline Offline

Posts: 1273



WWW
« Reply #6 on: July 31, 2011, 01:17:00 PM »
ReplyReply

And another example, specially propicious to work fine (high contrast text and drawings):

Lines in edges:




Or with zones:



which style would you prefer on your camera?


Regards
Logged

hjulenissen
Sr. Member
****
Offline Offline

Posts: 1666


« Reply #7 on: August 01, 2011, 08:26:56 AM »
ReplyReply

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
Logged
NikoJorj
Sr. Member
****
Offline Offline

Posts: 1063


WWW
« Reply #8 on: August 01, 2011, 09:09:35 AM »
ReplyReply

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.
Logged

Nicolas from Grenoble
A small gallery
Mike Sellers
Sr. Member
****
Offline Offline

Posts: 354


WWW
« Reply #9 on: August 04, 2011, 07:10:43 AM »
ReplyReply

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.
Logged
erick.boileau
Sr. Member
****
Offline Offline

Posts: 469


WWW
« Reply #10 on: January 12, 2013, 02:08:34 AM »
ReplyReply

Very interesting  ... and nearly no answers

many thanks
Logged
Fine_Art
Sr. Member
****
Offline Offline

Posts: 1057


« Reply #11 on: January 12, 2013, 04:20:55 PM »
ReplyReply

Thanks for providing this good info.
Logged
Remo Nonaz
Full Member
***
Offline Offline

Posts: 244


WWW
« Reply #12 on: January 14, 2013, 03:52:56 PM »
ReplyReply

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/ 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.
Logged

I really enjoy using old primes on my m4/3 camera. There's something about having to choose your aperture and actually focusing your camera that makes it so much more like... like... PHOTOGRAPHY!
auctionman
Newbie
*
Offline Offline

Posts: 1


« Reply #13 on: January 20, 2013, 08:20:42 AM »
ReplyReply

Thank you for such a great demo!
Logged
DanOksnevadPhotography
Newbie
*
Offline Offline

Posts: 2


WWW
« Reply #14 on: October 08, 2013, 10:34:59 AM »
ReplyReply

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!
Logged

Checkout my Minneapolis wedding photography portfolio: http://www.danoksnevadphotography.com/
Glenn NK
Sr. Member
****
Offline Offline

Posts: 259


« Reply #15 on: October 08, 2013, 11:48:41 AM »
ReplyReply

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
« Last Edit: October 08, 2013, 11:51:12 AM by Glenn NK » Logged

Economics:  the study of achieving infinite growth with finite resources
cottagehunter
Jr. Member
**
Offline Offline

Posts: 72


« Reply #16 on: October 08, 2013, 09:54:35 PM »
ReplyReply

The sony a99 allows you to do focus peaking in one of three colur choices. Red, Yellow and White

Pierre
Logged
elied
Sr. Member
****
Offline Offline

Posts: 253


« Reply #17 on: October 10, 2013, 01:49:48 AM »
ReplyReply

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.
Logged

Roll over Ed Weston,
Tell Ansel Adams the news
Dr Tone
Newbie
*
Offline Offline

Posts: 13


« Reply #18 on: October 11, 2013, 07:59:37 AM »
ReplyReply

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.
Logged
Glenn NK
Sr. Member
****
Offline Offline

Posts: 259


« Reply #19 on: October 12, 2013, 01:42:09 PM »
ReplyReply

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?
« Last Edit: October 12, 2013, 01:43:51 PM by Glenn NK » Logged

Economics:  the study of achieving infinite growth with finite resources
Pages: [1] 2 »   Top of Page
Print
Jump to:  

Ad
Ad
Ad