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

Tuesday, May 30, 2017

Focus Stacking using the Focus Bar

In previous posts I introduced the focus bar, which is a Magic Lantern add-on via a Lua script.

This post is all about a new feature that helps with manual (sic) focus stacking.

Landscape focus stacking is more complicated than ‘simple’ macro focus stacking, where the near and far depths of field are very small, eg of the order of a millimetre, and symmetric about the plane of focus.

In landscape focus stacking we need to keep track of the near and far depths of field, which are not symmetric about the plane of focus, and that vary with focus, focal length and aperture.

Assuming you have the focus bar script up and running (download FOCUS on the right), you will have a new tool to do manual landscape focus stacking. Before discussing the workflow, it is worth a reminder on how the focus bar works, which for this post is put into Depth of Field mode, option -1. Also the focus bar diffraction is set to OFF and the ML diffraction set to ON, which maximises the amount of information that is presented on the Live View screen.

With the above setting you should see this:

Where: ODoFN is the optical only near DoF distance, ie zero diffraction is assumed (the blur used is that set in the ML setting); ODoFF is the optical only far DoF distance; TDoFN (left green dot) is the total near DoF with diffraction accounted for; TDoFF (right green dot) is the total far DoF with diffraction accounted for; and FP (red dot) is the focus plane (point). The ODOF distances are shown on the focus bar and the TDOF distances are shown at the bottom of the LV screen, just above the focus plane distance (assuming you have set Diffraction aware in the ML menu. Thus, with the focus bar set up this way, you have all the info you require to make informed decisions about your focus.

Note you can set the ML and focus bar DoFs independently according to your preferences. The useful combinations being:

  • ML = diffraction aware : Focus bar = diffraction off
  • ML = simple : Focus bar = diffraction on [My preference]
Because the focus bar is in its DoF mode, the grey shows the focus field. Black indicates where the (total) focus blur is equal to the ML set total blur (ie CoC) criterion, eg, say, 30 microns on a full frame (or whatever blur total you have set; remembering that total blurs should fall between, say, 30 (OK for on screen) and around half that (say 15 for quality printing), according to your final presentation needs. White indicates a blur of zero, which can only occur at the plane of focus and with zero diffraction.

Now we understand what we are looking at, let’s look at the generic situation, ie before we look at the workflow landscape focus stacking.

The focus stacking info is available once you take an image. As you capture an image the focus bar script registers the total near and far DoFs for that image. These reference DoFs are then used as you refocus to show the amount of focus overlap between the last image taken and any refocusing you are doing. The following chart (FB = diffraction OFF and ML = Diffraction aware) is illustrative:

The middle focus bar shows the status of the bar when the last image was captured. The focus bar at the top illustrates what you will see if you refocus towards the macro end; and the focus bar at the bottom illustrates what you will see if you refocus towards the infinity end.

In both cases the magenta area shows the focus overlap, ie the overlap between the total DoFs of the last image captured and the focus state you are in. The magenta area dynamically changes as you refocus, giving you full feedback on the focus overlap state relative to the last captured image.

One thing to note is that, as you refocus, you will observe that EOS lenses (Canon or not) do not have infinitely varying focus, ie they tend to refocus in steps, ie as you rotate the lens focus ring. Plus these steps vary across the focus range of the lens. Thus you will need to ‘play around’ with focus to ensure you have a suitable magenta area. Too much magenta means you are ‘wasting’ focus (see above), ie overlapping too much; no magenta showing means you have zero or less overlap.

In the illustration above, it is clear to see that the we have too much overlap, ie we are wasting focus; as, in a perfect world, the TDoFs (last to current) should be ‘just’ overlapping. But you will not see this condition very often, because of the lens-focus control. Thus you should be aiming for something like this, ie with the smallest magenta area relative to the green dots, ie the total DoF deltas:

The magenta between the total DoF (green dots) and the end of the focus bar, simply shows the difference between the current optical-only DoF, relative to the last image captured total DoF, ie with diffraction. Note this changes if you set the focus bar to show diffraction corrected focus field. Then things would look like this (which is what I personally prefer):

Whether you have the focus bar showing the optical focus field or the total, is a personal choice. For most, once you have played around with the optical presentation, you will likely switch the focus bar to showing the total DoFs, as these are the ones you are interested in. But note, in doing this, we are duplicating the information on the LV, ie the focus bar DoFs are the same as the ML DoFs; unless you switch these around ;-)

[Note at the time of posting the ML DoFs are ‘broken’; however, as the FOCUS script is now independent of ML calculated DoF info, the ML ‘problem’ can be ignored. The ML focus menus are still OK to use, ie to set DoFs to ‘simple’ or ‘diffraction aware’, ie FOCUS uses these menus.]

Now we understand how the focus overlap feedback works, let’s see it in action in a landscape still, photography example. As stated above, let’s assume we are on a tripod, composed and the exposure is optimally set; and that we wish to maximise what is in ‘high quality’ focus, ie from infinity down to close in the near field, and closer than we could capture in a single image.

In this scenario it is usually best to start focus bracketing at infinity. Thus, using the focus bar, all we need to do is focus towards infinity until the focus bar switches into infinity mode, where the near and far DoF distances switch to showing the near DoF distance that matches the infinity blur, and the far DoF shows the total blur at infinity. Also note that for the near DoF you can have the focus bar report the DoF distance based on the total blur at infinity, or twice this: your choice. This x2 option is only really of value if you are not focus stacking, and you wished to be reassured that your near DoF is going to cover the things of interest in the near field. Because we will likely be seeking out an infinity blur that is less than the blur criterion, we can afford, in the near field, to use a 2 x total blur as our criterion, ie for a single image capture.

The focus bar at infinity (assuming set to show total DoFs, ie green dots at the end of the focus bar) will look like this:

Here we see that we have focused to a point where the total blur at infinity, for the far DoF, is at 16 microns. This implies a high quality focus. Note, you should not over focus at infinity. It is best to focus until the infinity total blur doesn’t change, then back of until you see a change.

At this point we would take our first image; at which time the focus bar registers the total DoFs.

We now simply refocus towards away from infinity until we see the minimum amount of magenta. For example things would look like this:

We can repeat the above as many times as we wish. However, for the sake of this post, we will stop here and note that, after post processing the two focus brackets, say in Helicon Focus or Photoshop, we will have a final image that has a high quality depth of field from YYY to infinity.

Finally, here is an actual screen grab, showing the focus bar in its DoF and focus stacking mode, and following an image capture, ie showing the magenta overlap zone. In this screen capture we see the focus bar in optical mode and the ML info (at the bottom) in diffraction aware mode.

Bottom line: the latest focus bar’s ability to give you focus overlap information is a very powerful way of taking control of focusing. Once again, Magic Lantern shows us what cameras should be able to do: if only manufactures open their minds.

Friday, May 19, 2017

Update to EOSM Toggler

Now I have the focus bar up and running, I needed to tweak the EOSM Toggler to ensure script-2-script compatibility in the UI.

The EOSM Togger was written specifically for the EOSM, ie this version is not a generic Toggler.

You can download the updated Toggler on the right.

The EOSM Toggler and focus bar look like this:

In the above screen dump we see the focus bar and the Toggler in its interactive mode, showing that the ML state currently selected (ready to change to) is AutoETTR. 

If you select this state (read the script's intro), then the Toggler will change the  ML Menus you have selected for that state and exit interactive mode. 

In interactive mode, you can go backwards and forwards through your Toggler states and have as many as you like.

The EOSM Toggler also works without the focus bar.

As usual I welcome feedback.

Focus Bar for Magic Lantern

A simple post to say I've rationalised the focus bar script and it now runs in the background, and controllable from the ML FOCUS menu.

I have cleaned up the UI and it now blends into the overall ML UI.

The focus bar script (FOCUS) on the right has extensive info built in.

The overall functionality follows from previous versions, eg:
  • I decided to keep the visualization of the focus field to a linear representation. I personally get more out of it this way. 
  • In addition to 'seeing' the focus field, and the fp and dofs, you can decide if you wish to see the near and far distance info shown below the bar.
  • For landscape photography, once the far dof is greater than 'infinity' the focus_bar distance reporting switches to total blur units (optical and diffraction in quadrature) at infinity for the far; and the dof distance based on the total infinity blur for the near dof.
  • Blur reporting at infinity is green if above the sensor limit (2xsensor pixels) and red below (make sure you set the correct sensor info for your camera).
  • The multiplier allows you to see the focus field beyond the far dof.
  • A multiplier of -1 switches the focus bar into dof mode. Note in all modes the focus bar functions during Canon zoom. Hint: this may help portrait photographers or videographers looking to 'ensure' the focus field is 'right', ie use Canon zoom and focus on the eyes (say) and check the focus field, ie front vs back focus.
  • A multiplier of 0 switches the focus bar into fp mode, ie see the focus field from zero to the fp.
  • I think it 'best' to have ML diffraction aware on (diffraction impacted green dots showing dofs) and switch diffraction off in the focus bar. This way you can see the impact of diffraction in the focus field. The focus field is black at unity blur (optical or with diffraction if selected). Unity blur is defined as the calculated blur divided by the ML set blur (CoC).
Finally, as always, I welcome any feedback.

Monday, May 15, 2017

FOCUS Tutorial

With the first (full) release of my new FOcus COmpanion Script (FOCUS, downloadable on the right), I thought I would write a short tutorial on one of the use cases, namely landscape focusing.

Before doing so, it is worth highlighting the core functionality of FOCUS:

  • It runs within the Magic Lantern Lua environment;
  • It runs continuously, unless you switch it off;
  • By default it is enabled in DoF (depth of field) mode, which we will discuss below;
  • The other modes are interactive mode, which allows you to direct the lens to the hyperfocal distance point, with various aperture options (we will cover this in a later tutorial); and a mode that provides more infinity focus info.

Before discussing how to use FOCUS, it is worth a reminder as to why focusing is not as easy as one would think.

First, modern AF lenses are great at what they do: auto focus. However, when it comes to manual focus, these lenses can be a challenge, eg no hard stop at infinity (to cover glass temperature variations and IR focusing) and, more importantly, very poor correlation between the lens markings and focusing distance, especially when you approach infinity, which, on a wide angle lens, favoured by landscape photographers, is not that far into the field.

Luckily, most modern lenses, even if they are not auto focus, report focus distance, which Magic Lantern gives us on screen and access to in Lua: in addition to aperture and focal length etc. In other words we have all the properties we need to do some interesting stuff.

Another reason that lenses are not ‘easy’ to focus is that their response is not linear. To see this all you need to look at is the focus info on the lens. For example, an x degree rotation of the lens at the macro end is not the same as an x rotation towards the infinity end.

Finally, the depth of field of a lens, ie the zone that to our eyes appears ‘sharp’ is not a simple function through the scene. For instance this chart shows a 24mm lens at F/8 focused at the hyperfocal distance. The green curve show the effect of diffraction, while the blue curve is ‘just’ the optical response. Unity is where the blur is just at our selected acceptable limit, ie around 30 microns here.

Around the plane of focus the difference is clear to see.  In the far field the curves asymptotically approach our set limit, 30 microns in this case; whereas in the near field’, focus collapses rather quicker and towards infinity blur. 

The above curve illustrates a key property of (non-macro) lenses, ie the near and far field responses are radically different: in a true macro lens the near and far depths of field are very small and ‘symmetrical’ about the plane of focus.

So how does the above insight and access to FOCUS help us?

The ‘secret’ of getting the sharpest landscape images, ie from the near to infinity, is to not (sic) use the hyperfocal distance, as, by definition, at infinity the focus is only just acceptable. See my previous posts for more information on HFD vs infinity focusing.

FOCUS brings you a new way to do landscape focusing, through access to three pieces of information: the total blur at infinity, a visual feedback on the optical focus field, ie without diffraction, and the 'usual ML' information about the near and far depths of field with diffraction.

OK, I appreciate some of you may have stopped reading, so lets show the Live View screen when FOCUS is running in its DOF mode.

Here we see the focus bar from FOCUS and, because we are in DOF mode, the left and right hand edges of the focus bar show the near and far depth of field points, ie the green dots (note the distances (within rounding limits) are the same as ML is reporting at the bottom). 

The red dot is the plane of focus, clearly illustrating the bias towards the near field. The focus bar shows the blur as it varies from 0 (white), at the plane of focus, to the ML set total acceptable blur (black), or Circle of Confusion if you prefer.

Clearly the above, random, starting position is not much good for our landscape, so let’s focus towards infinity until we see ML reporting that the far DoF is at infinity. 

The following image shows that we are at now at the HFD, a distance on 71cm, as ML is reporting the far DoF at infinity: as is the focus bar, which is telling us that the total blur is in fact around 28 microns, ie we have (manually) slightly ‘over focused’.

The key thing to note is that throughout the focus field, the acceptable focus is virtually fixed, ie the same level of grey (note the focus bar only shows optical focus blur, ie not diffraction). In this case black equals 30 microns. A total blur of 30 microns would be OK for screen representation, but not for high quality printing, where you would like to see a total blur of, say, half this.

But remember, although we are at the hyperfocal distance, we are in fact only focusing at about 71cm! What if we carried on, say, to the lowest total blur that we can get at infinity. This image next shows that state.

We have now moved focus to 4.25m and the total blur is reported as 12 microns. This is practically the lowest we can achieve with a 5D3, ie below this we are ‘breaching’ the 2xsensor limit, as the 5D3 sensor pitch is about 6.3 microns. Also note the focus bar greyness has shifted towards white, indicating that the optical blur across the field is about as low as you can get it.

So what have we gained by focusing beyond the HFD?

Well we have achieved about double the ‘total focus quality’, ie 12 microns vs 30 microns; which equates to doubling the print (lp/mm) quality. But what have we lost?

In this case, with a 12mm focal length, the acceptable near depth of field has reduced from 34cm at the HFD, to 1.1m using the infinity blur focusing approach. 

Note: the left hand of the focus bar reports the total (optical & diffraction) near depth of field if the far depth of field is less than infinity, ie at the HFD. Once the far depth of field is greater than infinity, the left hand end of the focus bar reports the depth of field that meets the infinity total blur, ie which will be different to the ML reported near DoF (1.1mm vs 55cm in the above example, ie the ML DoFs use the ML set total blur criterion, eg 30 microns in this example.

Clearly it is up to you to decide whether the above is acceptable, eg near field depth of field. But note you have a lot of information to use, eg:

  • A total blur at infinity of 12 microns, as good as you can hope to get;
  • A near DoF, based on 12 microns, of 1.1m;
  • A near DoF, based on 30 microns, of 55cm.

So let’s sum up.

With the new FOCUS approach to focusing we have the advantage of visually ‘seeing’ the focus field, as well as gaining access to some critical information at infinity. These new pieces of information, together with the ML supplied info, represents a new and enhanced way to control focus in your images.

In future posts I will provide more ‘case studies’ related to FOCUS, as well as illustrating additional functionality.

I hope you find this new approach as useful as I have; and, as usual, I welcome any feedback.

Saturday, May 13, 2017

Introducing the 'The Focus Bar'

In previous posts I introduced a 'new', Magic Lantern based, approach to landscape focusing; based on the idea of monitoring the optical, diffraction and total blurs at infinity.

This approach is simplicity itself, as all one needs to do is monitor the blur (provided in microns) and stop focusing when your blur criterion is reached.

For example, for full frame landscape photographers a total blur of, say, 30 microns is OK for screen presentation. If, however, you are seeking the best quality for printing, then a total blur goal at infinity of, say, 15 microns may be a better goal. But note blurs are related to image size and viewing distance.

Once your blur-focus condition at infinity is met, the script provides info on the near field depth of field position, that also meets the total blur criterion. Thus you know you have achieved your focus criterion from the near distance to infinity.

In this post I'm introducing (in beta) a new feature: a focus bar (see image below):

This 5D3 screen dump shows the landscape focus helper, with the new focus bar.

This version 'only' provides a visual feedback on the optical blur through the scene: although I plan to add in diffraction, ie so you can visualize total blur, in a later release.

The focus bar provides you a visual impression of the blur through the field, the red dot being the point of focus. This is important information for those seeking high quality images, as, unlike diffraction, optical blur changes through the depth of field.

The left hand distance is set at the HFD/4: as this script is for landscape photographers, ie unlikely to be seeking focus below HFD/4.

The right hand distance is a user variable and adjusted by a multiplier (from the script's menu). The multiplier is based on sensor-limited 'infinity' (which the script calculates), ie the distance where the optical (sic) blur is the same as the sensor pitch, or the size of single sensor site. That is about 6.3 microns on my 5D3.

The colours provide info on the optical blur through the scene, based on a menu selected 'unity blur', eg 30 microns was used above. The colours provide the following info:
  • Black: an optical blur equal or greater than the unity blur x a multiplier (1-9)
  • Grey: the blur between Black (above) and a unity blur (white)
  • Green: a blur between the unity value, eg 30 microns above, and half this
  • Yellow: a blur of less than half the unity blur, eg less than, say, 15 microns
  • The red dot is the focus point and this varies from HFD/4 to the limit identified above. If focus goes beyond the set limit, the red dot will be shown outside the focus bar, providing another piece of info to be used.
The script is available from the download area (right), ie HFD3. Currently this is a beta release and I welcome feedback.

Wednesday, May 10, 2017

To Infinity…but not beyond!

Modern lens are technical marvels and simple to focus via their Auto Focus (AF) feature. However, this simplicity hides some complexes: take infinity focus.

On older manual lenses there tended to be a hard infinity, ie the lens stopped focusing at infinity. These lenses were usually ‘calibrated’ by the manufacturer; thus one could set infinity focus in the dark, ie rotate the lens focus ring until it stopped. They also tended to have rather impressive markings on the lens to find specific distances, eg the hyperfocal distance.

With a modern AF lens, scales are rather ‘difficult’ to read and infinity is rather confusing, as you can focus beyond infinity, ie you are in the dreaded lazy L zone.

The lens manufacturers say that the Lazy L is there mainly to account for temperature variations in the glass and when you need to focus at Infra-Red frequencies.

OK, this sounds rather nice, but for the majority of photographers, the lazy L zone is rather wasted, eg how do you know by how much to adjust the infinity at a given glass temperature.

Because of the ‘confusion’ over infinity and the lazy L, I’ve decided to add a working-infinity feature into my Landscape Focusing Helper Script (see HFD2 on the right).

For those interested in the ‘simple, ie arm-waving, science’, the logic goes like this:

  • The human eye can only resolve details down to a certain limit. For someone with ‘normal’ eye sight it is said that one can resolve 5 line pairs per millimetre (lp/mm) at about 250mm away (10 inches);
  • The camera’s sensor has thousands of pixels, eg on my 5D3 the pixel pitch is about 6.3 microns. Thus, on the sensor, a lp is about 13 microns, ie 2 x 6.3 microns, equivalent to about 80 lp/mm on the sensor;
  • It is reasonable to consider a ‘focus blur’ (some may prefer to call this a circle of confusion) on the sensor as having a minimum that relates to this sensor-blur limit, ie about 13 microns;
  • The total (system) blur that we record is an amalgam of many sub-blurs. Once again, simplifying  things we may reduce the sub-system blurs down to two main ones: the optical blur that the lens creates, and that varies over the depth of the scene, and the diffraction blur, that is flat across the scene;
  • For the optical blur, we will simplify things even more and assume the lens is symmetrical;
  • We now have a way of defining a working-infinity, which we will define as a focus distance that creates a specified optical blur on the sensor. From the above, we can sensibly say that this blur can not be less that one pixel on the sensor, so let’s use that as our blur criterion;
  • The focus distance at which a specified blur (on the sensor) gives a specific value at infinity can be estimated (sic) by:
  • Where fd is the focus distance, f the focal length, k is the blur criteria and N the aperture number. Of course, the above calculates the HFD if you use that blur criterion, eg 30 microns;
  • As an example, at a focal length of 12mm, an aperture of f/10 and a blur criterion of 6.3 microns (our sensor pitch or size), infinity comes out at about 2.3m! Bluntly, focusing beyond this distance will not provide any more 'infinity detail' or in-focusness or 'acceptable out of focusness'.

Pulling all this together, how would I use the landscape infinity focus helper script on my 5D3? That is using Magic Lantern and my script

Here’s how, ignoring all the other ‘stuff’ like exposure and composition:

  • First, decide on the blur criterion you wish to use at infinity, remembering that on a full frame 5D3, a total blur of, say, 30 microns is ‘OK’, ie good enough for an HD monitor presentation (but worry about that 8K monitor you will buy in the future), and ‘OK’ for looking at a 10x6 (in) image at arms length - about a 5 lp/mm result on the print. For gallery and/or competitions, consider a total blur criterion at infinity of half the above, say, 15 microns: ie taking a hit on the near field DoF distance;
  • Ensure the ML settings are OK, ie diffraction aware on and DoF visible in LV;
  • Switch to Live View (LV) and look at the script’s info box. Let’s assume we are using a 12mm lens at f/8;
  • Focus towards infinity until the total (system) blur is around 15 microns. To illustrate things, here is a screen dump from my 5D3:

  • At the bottom we see that ML is reporting that the lens is focused at about 1.51m, giving an ML reported DoF from 46cm to infinity (based on a set 29 microns total blur in ML);
  • The script is showing additional info, ie that the infinity is anything beyond about 2.7m (!!!), and that a total blur (RMS of diffraction (11) and optical (12)) is about 16 microns at infinity, giving a near DoF of 64cm. That is we have achieved enhanced focusing (15 micron total blur) from 64cm to infinity;
  • As we haven't yet reached the lazy L zone, let's keep focusing towards the lazy L infinity zone;
  • The first thing that occurs (above) is the total blur turns red, warning us that the total blur is now less than the sensor limit, ie about 13 microns on the 5D3. This means that it is not really 'worth' focusing any more towards infinity. Remember, the more you focus towards infinity, the more DoF you lose in the near field (note we are now at 1.1m). But let's keep going, as the lens allows us to keep moving towards the lazy L zone. The optical blur (the centre blur reported above) turns red (below), warning that we are now focusing at or beyond an optical blur of zero;
  •  Going beyond this means we are over focusing. Note that our near DoF is reporting 1.6m: and we still could go on!
Bottom line: If using my script, good practice is to ensure there are no red warnings. Once you decide on your infinity total blur, eg between 15 and 30 microns on a full frame camera, getting the optimum landscape 'infinity focus' is simplicity itself. There is no need to worry about 'where is infinity'.

A final word of warning: appreciate the 'limitations' of the script, ie it is suited for 'shortish' lenses, ie don't expect to use the script on your 70-200; use it on your wide angle lenses.

As usual, I welcome any feedback on this post and any ideas to make this approach to landscape focusing better.