Wednesday, June 28, 2017

Focus Bar update

A short post today just flagging the latest version of the focus bar (FOCUS on the right) as been released.

This version has a clearer 'user manual' in the text of the script and introduces an additional way to 'see' the defocus blur.

In the default DoF mode, where the two extremes of the focus bar show the near and far DoFs and the grey shading provides an impression of the focus field, I have now added in 10% distances.

Also, at these 10% distance points the focus bar shows an impression of the defocus blur diameter (ie the total blur less the diffraction effect), which will be at a maximum at the DoFs.

A black defocus blur means the blur is above the sensor limit, ie 2 x sensor pitch. A red defocus blur means the blur is below the sensor limit. Obviously at the point of focus the defocus blur becomes zero. The green dot, between the two DoFs, is, of course, the point of focus.

This version of the focus bar completely handles DoF, so switch off the DoF display in the ML DoF menu, but switch on the ML diffraction aware setting.

The DoF feedback at the bottom, ie above the ISO feedback, represents the near and far (defocus) DoF distances, with the defocus blur in the middle in microns, ie the total blur criterion less diffraction. The DoFs are zero because I haven't taken an image yet. Once an image is taken, these DoFs record the last image's DoFs, which is useful to know when focus bracketing. 

Here is what things now look like in the default DoF mode. BTW the red dots are simply from the cropmarks overlay I use, ie they have nothing to do with the focus bar.



As usual I welcome any feedback, especially ideas to make the focus bar more useful. BTW for those using the focus bar on an IR converted camera, you should change the diffraction frequency at line 150 in the script, eg from 550nm to, say, 850nm.

Wednesday, June 14, 2017

Close enough

Now that my focus bar script is up and running, with a focus stacking functionality; I decided to take a deeper look at the math, and, in particular, the effect of ignoring the pupil magnification. That is, the current depth of field equations, like most DoF calculators, assume a symmetrical lens with the exit and entrance pupils being the same, ie a pupil magnification (P) of unity (exit pupil size divided by entrance pupil size).

You can easily check the symmetry of your lens by simply holding it up to the light and looking at the size of the opening from the back and the front: usually best done after closing down the lens down by a couple of stops.

Wide angle lenses tend to be retrofocus, ie P>1; whereas telephoto lens will have P less than unity. Also P will vary with focus length, thus complicating using P with a zoom lens.

Typically the extremes of P vary from 0.1 to 10. Ignoring Ps greater than one will lead to overestimating the depth of field. Whereas ignoring Ps less than one will lead to underestimating the depth of field.

All the literature implies that for most photography, especially landscape, where we tend to focus at a distance, ie relative to the focal length, the pupil magnification can pragmatically be ignored. The only time that P becomes important is in macro photography, ie where we are focusing close to the focal length.

Rather than ‘just’ accept the implied wisdom, I decided to take a look at the impact of P, albeit limited to my normal photography genre of nature or urban landscapes, ie where I will be focusing at a distance.

For those interested, the near and far depth of fields can be calculated from the following (taken from toothwalker.org), where: P is the pupil magnification; v the point of focus; f the focal length; C the lens blur, ie CoC; and D the lens aperture = f/N; N the F-number.



For the case of interest, ie a wide angle, retrofocus lenses, say with Ps in the 1 to, say, 5 region, the impact on the depth of field is to reduce it: but by how much?

To illustrate the impact, let’s assume a hypothetical 12mm asymmetric lens, with a pupil magnification of, say, 5, on a full frame camera set at F/16, and with a blur criterion on 30 microns. For simplicity we will ignore diffraction.

Using the above equations it is easy to show that if we focus at the hyperfocal distance, of about 312mm, the near depth of field, for a unity P value, is 156mm, ie HFD/2. Whereas, if P was, say, 5, the near depth of field will change to about a 160mm (leaving all variables unchanged), ie a ‘loss’ of depth of field of 4mm! If P was 2, then the near depth of field would be just short of 159mm, ie a ‘loss’ of 1mm!

If we focus at less than the hyperfocal, say, at HFD/2 (156mm), then the near and far depth of fields for P = 1 and P = 5, would be 105mm vs 107mm and 300mm vs 294mm. respectively. Once again, hardly significant.

In other words, we are taking about a few % changes and, hence, it does indeed appear safe to ignore P for non-macro photography.

However, things can be better if you adopt best practice when landscape focusing, eg either using infinity-biased focusing or even focus stacking.

Assuming you are using the focus bar, which has a focus stacking feature, use the ‘pink bar feature’ to ensure that, image to image, the depths of field overlap. The ‘only’ loss being the final image’s near depth of field loss, which is only mms as we saw above.

Also, whether you use focus stacking or not, it is important to avoid using a ‘simple’ hyperfocal approach for your farthest image. That is always focus beyond the hyperfocal and, using the focus bar, seek to minimise the infinity blur (which is provided via the focus bar, when focusing beyond the HFD). If this results in an unacceptable near depth of field, then add in one or two near depth of field focus brackets, ie using the focus bar to help you manage the image to image overlap.

Bottom line:

  • Although far from exhaustive, it is clear, that for non-macro photography (sic), it appears reasonable and pragmatic to assume our lenses are symmetrical, after all the depths of field are there to inform our photography choices, not control them. Also the focus bar illustrates that the ‘fall off’ in the focus field is not a cliff edge, especially for the far field;
  • The issue is not using the equations, as it would be simple to add the ‘P-factor’ to Lua depth of field scripts in ML, eg in the focus bar script; the complication would be measuring P, and keeping track of it as you varied lenses, especially if you have a zoom lens;
  • By not (sic) using an HFD approach, and undertaking an infinity-biased focus for your landscapes, ie focusing towards infinity and away from the HFD, you can safely ignore the pupil magnification, and get better depth of field quality at infinity;
  • If you then find the near depth of field too far away, then the focus bar provides an easy way to capture further near depth of field brackets.

As usual I welcome any feedback on the above post.

Saturday, June 3, 2017

Getting the best out of the Focus Bar

Now that the focus bar is ‘stable’ and I've optimised it for my use (sic), I thought I would provide a few words on how others can get the best out of it.

In a similar way to how ML’s ETTR, and RAW Spotmeter etc, gives you the best information with which to set exposure; the focus bar is your friend when it comes to getting the most out of your focus.

The current version of focus bar is totally independent of the ML calculated DoFs, thus I advise you switch the ML DoF displays off, but put ML diffraction aware on. This independence is there as the current ML DoFs are broken and should not be relied on (an ML pull request is in hand). The focus bar replaces the ML DoF display with the ‘correct’ DoFs. However, even when the ML DoF is fixed, when using the focus bar, simply switch off the ML DoF display and let the focus bar provide you all the info you need in a self-consistent manner. For example, the next update of focus bar will provide you additional blur data to inform your focus choices.

As we know, the total blur we see in our images is mainly (sic) made of two components:

  • The defocus blur that is generated by the optics of the lens, and that varies over the depth of field from ‘zero’ to ‘infinity’, and is approximately (the current version of focus bar ignores such things as the pupillary magnification) related to ‘only’ the focus distance (fd), the aperture (N), the focal length (fl) and the total blur, that is usually called the Circle of Confusion, ie the acceptable blur below which our eye-brain system only sees things ‘in focus’; 
  • and the diffraction blur, that is, for non-macro lenses, weakly dependent on focus (ie the diffraction magnification term is defined as (1 + M), where M = fl/(fd-fl)), and linearly dependent on aperture. For fd >> fl, ie usually the case for non-macro photography, the magnification effect on diffraction can be ignored and is zero at ‘infinity’. Note fd/(fd-fl) = (1 + M). Although a minor effect for non-macro photography, in the focus bar script M is accounted for.
It is usual practice to assume the total blur (ie total CoC criterion, as defined in the ML menu) is only composed of the defocus and diffraction blurs taken in quadrature, ie total_blur^2 = defocus_blur^2 + diffraction_blur^2.

Thus, when you are looking at any DoF info, say calculated by a 3rd party App, you need to understand what you are looking at, eg does it include diffraction? Hint: as real photographers we need to account for diffraction (accepting that some say you can ‘remove’ it in Photoshop, albeit with artifacts), hence, for landscape photographers, it is nearly always the case that we should be using DoFs in their diffraction aware mode.


As mentioned in previous posts, a total blur criterion of, say, 30 microns, on a full frame camera, will be OK for web use, but maybe not for high quality print presentation, especially if the print is being reviewed close up. For high quality, a total (sic) blur criterion of, say, 15, should be a goal. Thus, total blurs at infinity of between 30 and, say, 15, means you are in the 'sweet spot'.

In the case of the focus bar script, you can independently have the focus bar showing the defocus only DoFs and ML reporting the diffraction corrected DoFs, but because we are interested in the real-world, it is best (hint again) to switch both the focus bar and the ML DoFs to diffraction aware, as both are used in focus stacking mode.

The focus bar script uses the ML menu to get the total CoC or blur criterion and to see if (ML) diffraction aware is on; and, as said above, irrespective of the ML DoFs being broken or fixed, switch of the ML DoF display, and use the focus bar displays alone (which BTW you can switch off if you wish).

At the simplest level the focus bar may be seen as a bit of fun, ie to help visualise how the focus field varies as we play around with the focal length, the focus distance and the aperture. Thus it is first of all something to use in the armchair as you think about your next shoot.

This education role of the focus bar is important as you see/hear guidance on the web that is, bluntly, wrong, eg “…focus a third of the way into the frame…”. Look at the focus bar and see if you feel comfortable with the 1/3 guidance. The 1/3 'rule' only works at one focus distance: so if you are not at that the 1/3 will be wrong.

However, ‘only’ using the focus bar as an education tool is missing the real value of the focus bar, which provides critical information for those seeking out the best focus in their images.

Caveat Emptor: the math to calculate the DoFs in ML and the focus bar are based on some simplifying assumptions, eg that pupillary magnification is 1 and we have a simple lens. For most use cases and ‘normal lenses’, ie non-macro, such assumptions are reasonable; however, as with many things in photography, the DoFs are there as an aid, ie to inform your decision, not a prop, ie that makes decisions for you.

The focus bar also assumes that the Canon-ML focus distance reporting is correct ;-)

Assuming you have downloaded the focus bar script and switched it on (BTW until the ML Nightly brings in the Lua fix 'stuff', ensure you are using the ML build from the Lua fix Experimental area of ML); the next question is: how do I use it? 


The default settings of the script will give you the following functionality at camera turn on:
  • Focus Bar in diffraction aware mode (remember to put ML in diffraction aware as well); 
  • Focus Bar in DoF mode, ie showing the focus field between the (diffraction corrected) DoFs;  
  • Focus Bar in x2 infinity mode (see below);  
  • Focus Bar in focus stacking mode (see below).
Assuming you have switched off ML DoF display, when you first switch your camera on you will see the DoFs at the bottom on the screen (in the ML reporting position) showing “0 I 0”, ie both zero. So what’s going on here?

Because the default mode is focus stacking on, and as you haven’t yet taken an image, the focus bar has no reference DoF info to show, ie the last image taken. Once you take an image the DoF display at the bottom will update to the DoFs for the image you last took. 


In focus stacking mode, as you refocus this DoF info at the bottom will all always show your last DoF info, ie the focus bar shows the dynamically changing DoF info. It will also show the focus overlap (magenta), relative to the last image, ie the DoFs at the bottom on the LV screen.

When the far DoF reaches ‘infinity’, the focus bar switches its info presentation to show the total blur at infinity, in microns, and the near DoF that corresponds to that blur criterion. This is necessary as far DoF distance now has no meaning, ie the far DoF is at infinity.


There is a user option to get the focus bar to show you the near (sic) DoF at twice this infinity blur. This x2 option is the default in the script. Thus, say the infinity total blur was 15 microns, a high quality criterion, then it would likely be acceptable to use a total blur of twice this, 30 microns, for the near field DoF, where objects are bigger ;-)

Once again, using the x2 feature is a user choice, and it’s main value is when you are taking a single infinity focused capture. With focus stacking switched on, the non-infinity DoFs are based on the total (ML) CoC criterion.


However, the DoF mode, with focus stacking and x2 option switched on, is a good default, especially for a landscape photographer, who will tend to start at infinity focus and, if that doesn’t give you enough near field focus coverage, then you will simply refocus and take additional images, using the focus bar to tell you when to take those images, ie minimum magenta bar showing. The focus bar x2 info is only shown when at infinity to help you decide if you can 'get away' with a single image.

Finally, when focus stacking it is worth thinking about post processing. One simple technique to use, is to take an image of your hand at the beginning and end of your stack. This way it is easy to see the images you need in Lightroom. Hint, as a refinement, use an closed and open hand at the start and end of the stack.
 

Bottom line: I appreciate that I may be the only user of the focus bar script [:-)], however, as I find it cathartic to write about stuff, I will continue to publish my thoughts on using the focus bar; and I hope others benefit from my efforts.