Pages: [1] 2   Go Down

Author Topic: How 'Focus Peaking' works  (Read 228530 times)

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
How 'Focus Peaking' works
« on: July 28, 2011, 01:21:13 pm »

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, 01:47:51 pm by Guillermo Luijk »
Logged

deejjjaaaa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1170
Re: How 'Focus Peaking' works
« Reply #1 on: July 28, 2011, 02:15:18 pm »

> 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: 3369
    • http://www.paulholman.com
Re: How 'Focus Peaking' works
« Reply #2 on: July 29, 2011, 01:28:34 am »

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: 22814
  • http://myrvaagnes.com
    • http://myrvaagnes.com
Re: How 'Focus Peaking' works
« Reply #3 on: July 29, 2011, 10:32:32 am »

Beautiful demo, Guillermo. Thanks for posting it.

Eric
Logged
-Eric Myrvaagnes (visit my website: http://myrvaagnes.com)

Mike Sellers

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 666
    • Mike Sellers Photography
Re: How 'Focus Peaking' works
« Reply #4 on: July 31, 2011, 09:37:08 am »

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: 2005
    • http://www.guillermoluijk.com
Re: How 'Focus Peaking' works
« Reply #5 on: July 31, 2011, 09:54:14 am »

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

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: How 'Focus Peaking' works
« Reply #6 on: July 31, 2011, 02:17:00 pm »

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

hjulenissen

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2051
Re: How 'Focus Peaking' works
« Reply #7 on: August 01, 2011, 09:26:56 am »

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: 1082
    • http://nikojorj.free.fr/
Re: How 'Focus Peaking' works
« Reply #8 on: August 01, 2011, 10:09:35 am »

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: 666
    • Mike Sellers Photography
Re: How 'Focus Peaking' works
« Reply #9 on: August 04, 2011, 08:10:43 am »

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: 468
    • http://
Re: How 'Focus Peaking' works
« Reply #10 on: January 12, 2013, 03:08:34 am »

Very interesting  ... and nearly no answers

many thanks
Logged

Fine_Art

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1172
Re: How 'Focus Peaking' works
« Reply #11 on: January 12, 2013, 05:20:55 pm »

Thanks for providing this good info.
Logged

Remo Nonaz

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 385
    • Photography By Homer Shannnon
Re: How 'Focus Peaking' works
« Reply #12 on: January 14, 2013, 04:52:56 pm »

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
Re: How 'Focus Peaking' works
« Reply #13 on: January 20, 2013, 09:20:42 am »

Thank you for such a great demo!
Logged

DanOksnevadPhotography

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
    • Dan Oksnevad Photography
Re: How 'Focus Peaking' works
« Reply #14 on: October 08, 2013, 11:34:59 am »

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: 313
Re: How 'Focus Peaking' works
« Reply #15 on: October 08, 2013, 12:48:41 pm »

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, 12:51:12 pm by Glenn NK »
Logged
Economics:  the study of achieving infinite growth with finite resources

cottagehunter

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 99
Re: How 'Focus Peaking' works
« Reply #16 on: October 08, 2013, 10:54:35 pm »

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

Pierre
Logged

eliedinur

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 328
Re: How 'Focus Peaking' works
« Reply #17 on: October 10, 2013, 02:49:48 am »

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 th

Dr Tone

  • Newbie
  • *
  • Offline Offline
  • Posts: 44
Re: How 'Focus Peaking' works
« Reply #18 on: October 11, 2013, 08:59:37 am »

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: 313
Re: How 'Focus Peaking' works
« Reply #19 on: October 12, 2013, 02:42:09 pm »

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, 02:43:51 pm by Glenn NK »
Logged
Economics:  the study of achieving infinite growth with finite resources
Pages: [1] 2   Go Up