Tuesday, May 14, 2019

Multi-image, Deep Focus Photography: Magic Lantern Helper Script


For those that seek to achieve ‘deep focus’ in their photography, ie from very near to infinity, you know that wide angle lenses are your friend. For example, an IRIX 11mm lens on a Full Frame camera, with an aperture set to f/10, with have a hyperfocal distance (H) of around 1.1m, at an infinity defocus blur of 11 microns. This follows from the Rule of Ten, where the hyperfocal is simply FL/10, when the circle of confusion, in microns, is the focal length (FL) in mm and the aperture is f/10.
 
Such a single image set up will provide a very high-quality focus over a deep focus field, ie less than 11 micron defocus blur, between 550mm (H/2) and infinity

But what if there was a feature you needed to include in the focus at, say, 150mm? The simple answer is you couldn’t achieve this in a single image and maintain focus quality through the scene.

This is where multi-image, deep focus techniques come into play, ie focus bracketing.
One of the challenges with multi image focus bracketing, apart from the wind, is knowing where to focus from image to image.

At the simplest level, for perfect focus bracketing, one would focus at H, H/3, H/5, H/7 etc. Thus, with four images, where H/7 being the shortest with a near and far depth of field at H/8 and H/6, the merged, focus stacked, depth of field will cover from H/8 to infinity. 

Thus, in the example above, with an H of 1.1m, focusing at 1100/7, ie at about 157mm, will achieve a four image depth of field from 1100/8 to infinity, ie from 137mm to infinity.

But notice how the near depth of field collapses with each image. For example, when focused at H, the near depth of field for that image was some 550mm behind the point of focus, ie at H/2. In the fourth image, taken at H/7, the near depth of field, ie relative to the point of focus, is H/56, some 20mm!!!!! In other words, you must really want that extra 20mm to do multi-image deep focus photography.

Of course, knowing distances in theory is fine on paper, but not much help in the field. So, as usual, Magic Lantern to the rescue; all assuming, of course, your lens reports focus distance etc. If it doesn’t, you are out of luck!

Over the years I’ve experimented with various ways of getting focus feedback using ML. I’ve tried automatically moving the lens, which has got better as Lua has matured (thanks to a1ex at ML); plus I’ve tried various Focus Bar arrangements that provide visual feedback to the user.

Although I like my latest focus bar (DoFBar), the down side is its (LV) readability in the field, especially without a hood/shade in bright sunlight. Plus, I (over)loaded it with features: that is, it’s just too complicated.

Last month I released my latest auto focus bracketing script (GFBS), which, IMHO, runs well: at least on my 5D3. Today, I’m releasing the latest version of my focus bar, that I’ve simplified, and targeted 100% towards deep focus photography and in-field (LV) viewing.

I’m calling this script the Bracketeer; and you can download it from the link on the right.
I believe the Bracketeer does three things rather well:

  • First it continuously shows you the defocus blur at infinity, the diffraction blur and the total blur at infinity, ie the defocus and diffraction blurs taken in quadrature. In addition to this blur information in microns, the script displays a simple traffic light system as an aid to focusing: 
    • Red: focus is less than H (H being based on the blur as set in the ML CoC, which is used as the overlap defocus blur) 
    • Yellow: focus is between H and 2*H, ie infinity defocus blur between the overlap blur and half of the overlap blur 
    • Green: focus is between 2*H and 4*H, ie overlap_blur/2 to overlap_blur/4
    • Orange: focus is greater than 4*H and less than ‘infinity’, ie you are now over focusing, but still based on camera distance information 
    • White: focus is at ‘infinity’, ie there is no distance information to be gained from the camera
  • Second it provides a continuous estimate of the number of focus bracket estimate from the current point of focus to the current hyperfocal; 

  • Thirdly, the killer feature, is the visualisation of the image to image focus overlap, ie between the current point of focus and the last image captured. The visualisation is prioritised to show the amount of overlap or the overlap gap.

The script uses the ML-set circle of confusion as the overlap (defocus) blur criterion. For a full frame I recommend this be set around 20-30 microns, and crop scaled on an APS-C camera. The script can be tweaked for IR, ie use a frequency in the script of 0.850, say, compared to 0.550 for a visible band camera.

The script has a simple menu, ie its either on or off; and it can be used in any direction, ie near to far or far to near. 

Once running the script continuously displays the three pieces of focus information. If the script is running alongside the auto bracketing script, the auto bracketing script will deconflict itself, ie you can’t have both scripts running at the same time. However, I recommend these two scripts be loaded as a pair; but note the auto bracketing script requires an AF lens, whereas the Bracketeer doesn’t.

The following illustrate the UI and show traffic lights in action.






In the above we see the point of focus moving through the red, yellow to green states of focus. We also see the blur information changing. The final yellow traffic light warns us that we are now focusing past 4*H. If we were it infinity, this traffic light would show white.

The full focus bracketing (bar) feedback only kicks in once an image has been taken. Before an image has been captured the top and bottom bars show the current focus info relative to the focus state at the script’s start up, ie time zero. 

After an image is captured, the top bar will show the last image’s depth of field, whereas the lower bar will always show the current point of focus’s depth of field. 

The following screen captures illustrate the two bars in action. The red ‘zone’ showing a focus gap. The left hand side of the bar display is positioned at the minimum of the two near depths of field. The right hand side is positioned at either H, if one of the bars far depth of field is greater than H, or at the maximum of the two bars’ far depth of field if both are less than H.






Finally, here is a test image I took with using the Bracketeer script; running on my IR converted EOSM. The focal length was 11 mm, the ISO 100, the aperture was set to f/6.3 and the shutter was at 10s. Using the Exif-tool GUI, we see that the Canon recorded (upper) focus information of the images taken, at: 0.19m, 0.25m, 0.40m, 1.54m and 3.84m.



Rather that drone on about the script, I will leave those with a curious mind to try it out (remove any of my old/legacy scripts). As usual I welcome feedback of any kind, especially how to make the script better.

No comments:

Post a Comment