Have taken the opportunity to tidy up some of the DoF Bar functionality. The download remains here:
https://gist.github.com/pigeonhill/fdbc6e2fbeed1206afcc47d69cee9591Here is the DoF Bar User Guide, that is embedded in the script:
DoF Bar is principally targeted at those that wish to obtain 'tack sharp' images from infinity to a near-field point of interest, eg landscape and cityscape photographers.
It can, however, also be useful to those who simply wish to know more about depth of field (DoF), especially when focusing beyond the hyperfocal, but short of 'infinity'.
It goes without saying that DoF Bar only works in LV and with lenses that report focus distance, focal length and aperture. DoF Bar checks for this and will only show itself if it is able to so do.
When bracketing, DoF Bar is best being used at the wider end, say 50mm or wider. However, it can be used with longer lenses, but be warned: focus bracketing can become tiresome at long focal lengths ;-)
For example, a 100mm lens at F/10, using an infinity defocus blur of, say, 10 microns, will have a hyperfocal distance of about 100m. Thus the number of focus brackets to cover from 1m, say, to infinity will be 50.
Where the number of focus brackets can be estimated from (H/2X), where X is the near Dof of the nearest point of interest.
The current focus is always shown by ML on the ML bottom bar and DoF Bar assumes you have set metric units in ML. DoF Bar will switch off ML shown DoFs, as they are not needed.
DoF Bar menu appears under the ML Focus menu. All DoF Bar menu states are remembered at camera close, so you don't have to keep entering your settings once you have arrived at your preferred configuration.
DoF Bar uses the ML set Circle of Confusion (CoC), ie the total (sic) blur criterion at the hyperfocal. The total_blur being calculated from SQRT(lens_defocus_blur^2 + diffraction_blur^2). With diffraction blur linearly varying with aperture alone, ie a lens at F/8 has twice the diffraction blur of one at F/4.
If ML diffraction aware is set to off, the ML (total) CoC is, obviously, only based on lens defocus blur. If ML diffraction aware is on, then the (lens defocus based) hyperfocal (H) is calculated by ML after diffraction is accounted for, ie lens_defocus_blur = SQRT(total_blur^2 - diffraction_blur^2).
If diffraction is too high, ie diffraction blur > total blur, the near and far DoFs will collapse to the focus point.
So, be warned: according to your ML set CoC, apertures much beyond, say, F/16, on a full frame (less than this on a crop sensor camera), are not practicable with diffraction on, ie you begin to lose DoF because of diffraction.
Because of diffraction, many photographers try and capture images around F/8 to F/10, as pushing things to F/16, whilst resulting in larger DoF, may introduce loss of image quality because of other factors, eg lens design.
You can switch DoF Bar on and off, ie hide it in LV, via the script's menu.
If DoF Bar 'disappears', for whatever reason, then simply carry out a half_shutter press or refocus or change lens state (length or aperture). This will return DoF Bar to LV.
The bar is segregated into three sub-bars, each with different scalings; in order to maximise the info presented in the bar.
The left hand (white) sub-bar covers distances from zero (an estimate of the camera's sensor plane) to a minimum focus distance that you set (this does not have to be the actual lens minimum).
This min focus is only a visualisation aid. The min focus is user set in the script’s menu and can be zero.
Hint: move your lens to the macro end until the near depth of field doesn't change. You may consider this to be your min focus and set this in the menu ;-)
The middle (green) sub-bar covers distances from your set min focus to the (diffraction aware) ML calculated hyperfocal distance (H). Thus, if the min focus is set to zero, the green bar will go from zero to H.
The right hand sub-bar (with three zones, white/black/white) covers distances from H to 2H / 2H to 3H / 3H to 4H. This zone is used when ‘infinity focusing’, ie beyond the ML calculated H.
Note that infinity blurs go in proportion to the multiples of H. Thus if focused at 3H, your infinity blur will be that at H (the defocus blur as set/calculated by ML) divided by 3, ie a third of that at H.
As defocus blurs less than twice the sensor pitch are rather meaningless; DoF Blur uses H/4 as a pragmatic limit.
In Pro mode (see below) DoF Bar will only allow you to set infinity blurs between H and 4H. For example, on a 5D3 twice the sensor pitch is about 13 microns. Whereas the ML set (full frame) blur will typically be set to 30 microns, as this is recognised as an OK criterion to use for 'normal' viewing of an image. The min infinity blur in this case is 30/4, which is about 8 microns, ie slightly less than the 'sensible' sensor limit.
Of course, for digital viewing, blurs can be more than for close scrutiny print viewing. But, unless you know the final presentation mode and what blur you wish to achieve, it is best to seek infinity blurs between 30 to, say, 12 on a full frame, and, say, 20 to, say, 8 on a crop sensor. DoF Bar, of course, helps you by indicating the sweet spot, ie green blurs.
If you have selected the 'Dynamic Bar' option, ie it is not set to OFF, then the DoF Bar will only show the green bar, if certain criteria are met.
The left hand of the bar will always be the lesser of the current near DoF and the near DoF of the last image taken. If DoF mode selected, the right hand will be at H if both the current and last far DoFs are greater than H; or at the greatest of last far DoF and current far DoF. If Hyperfocal mode selected, the right hand will always be at H.
These two dynamic modes become useful as you focus towards the macro end, so the advice is have the Dynamic Bar switched on. Just try it ;-)
There are three 'info areas’ above the bar. The left hand one always shows the current near DoF distance, as reported by ML.
The right hand info area shows the current (ML) far DoF distance if the focus distance is less than (ML) H. If the focus is greater than the ML H, this info area shows the infinity blur (in microns) at the current focus distance, which will be between the ML calculated hyperfocal (defocus) blur (ie ML CoC if diffraction aware is off) and zero if focused at infinity. Blurs of zero only occur at the point of focus.
The third info area only appears in Pro mode and shows the current ML calculated defocus blur (diffraction aware sensitive) and the infinity blur that is currently set. The infinity blur is set by taking an image between H and 4*H.
This infinity blur will then remain in force UNTIL the lens state changes, ie aperture or focal length. If you change lens state, you will need to take another image between H and 4*H to reset the infinity blur.
Or, put another way, if you wish to reset the infinity blur, all you need do is change lens state and take an image between H and 4*H.
In its non-bracketing mode, Focus Bar shows the three main focusing fiducial markers/semi-dots below the bar. Red is the focus point and the left and right white semi-dots show the near and far DoFs as calculated by ML.
As soon as you take your first image (anywhere), if bracketing mode is set to off (script’s menu), all you will see are these dots mirrored on top of the bar and these will remain mirrored as you refocus.
However, if you are in bracketing mode, once an image has been captured, the upper dots will now be (remain) positioned at the last captured image’s points of interest, ie near-DoF, focus point and far DoF.
The current focus white far DoF semi-dots will turn blue when you have opened a 'focus gap' between your last image taken and the current focus.
You can now use these top and bottom dots to inform your focus bracketing, ie refocus until the lower far DoF is just greater that the upper near DoF (of the last image), ie white and not blue.
Thus, in bracketing mode, you can focus bracket from anywhere at anytime.
If you are focusing at the Canon/ML indicated infinity, the lower dots will turn black as you are in a potential over focusing state, according to the lens you are using. This is only a warning, but remember that pro mode does not work beyond a focus of 4*H.
Note: the (non-Pro) DoF dots work in any focusing direction, from near to far as well as far to near.
Due to the coarseness of the Canon distance reporting, you may not always be able to position your focus to exactly where you want: so do the best you can.
If you are in Pro Mode (set in the script’s menu) two additional upper and lower (magenta) semi-dots will appear. The upper magenta semi-dot shows the near DoF of the last captured image you took between H and 4*H, using the infinity blur at that point to calculate the (infinity blur based) near DoF. The lower magenta semi-dot shows the (infinity blur based) far DoF at the current focus, once again using the infinity blur criterion established when you captured your image between H and 4*H.
As you refocus, to achieve the perfect focus bracket, the lower magenta semi-dot will change from magenta to blue when you have opened up a focus gap. Note in Pro mode you should focus bracket from far to near.
The infinity blur criterion will remain fixed until you change the focal length, aperture or the ML set hyperfocal by changing the CoC in ML.
Thus you can use focus bracketing at, say, image sequences less than H, BUT, in Pro mode you must have taken at one image between H and less than 4*H, and, of course, focus stack from far to near.
In Pro Mode, having taken an image at your selected infinity blur, all you need to do on subsequent focus brackets is to ensure the two magenta dots (top = last near DoF and bottom = current far DoF based on infinity blur) are as close together as possible (that is as close as the Canon focus reporting allows); and both are magenta, ie if the lower turns blue you need to refocus or accept where you are if the current far (white) DoF marker is still white, meaning that you are between the ML set/calculated blur and the infinity blur DoFs.
If both magenta and white far DoFs of the current focus are blue, you will have a (real) focus gap that needs fixing.
In Pro mode the middle Info area reminds you of the blurs that are being used to calculate the white and magenta DoF dots, ie ML set (at the OK focus quality level) and your currently active infinity blur (high quality).
If you change the focal length, the aperture or the ML set CoC; the DoF Bar will reset to its ‘camera on’ state, eg the upper dots will disappear, until you take another image. Plus, in Pro mode, the infinity blur based info will be reset and you will need to take an image between H and 4*H to establish a new (Pro mode) infinity blur.
Finally, you can use DoF Bar as a visualization tool. For instance to gauge/set a maximum DoF by simply adjusting aperture and looking at the changing DoFs until they are at their maximum and suit your needs.
Caveat emptor: remember that the equations that ML and DoF Bar use are good approximations away from the macro end, based on mathematically simplifying the lens. In other words, don't use DoF Bar with a macro lens!
Finally here is a demo screen shot of Pro mode.
