Friday, November 25, 2022

Deep Focus Bracketing Hack: Addendum

In the last post I discussed a depth of field hack that can easily be used to help manually capture perfect deep focus, landscape stacks, ie when non-macro focus bracketing.

The hack was based on knowing the location of the (infinity) front principal from the PhotonsToPhotos (PTP) Optical Bench Hub, and ignoring any lens extension, as the hack is aimed at non-macro, wide angle photography, where the magnification and lens extension impact will be small.

But what if your lens isn’t in the PTP database?

In this post I show a quick approach to estimating the front principal location, from a single, simple measurement.

Although it is difficult/’impossible’ to directly measure the front principal (H), it is relatively easy to measure the location of the on-axis entrance pupil (EP) location, P in the diagram below. At least for a ‘normal’, non fisheye lens.

In the above example, of the Sigma 12-24, at 12mm, we can see (by observing the ratio of the exit to entrance pupils), that the lens is, as expected, a retro focus one, with a pupil magnification (p = Exit Diameter divided by Entrance Diameter) of about 6. Thus, using the thick lens  model, we know that EP is offset, ie in front of the front principal H, by F(1-1/p): about 10mm in this case.

The value of p can be measured, eg taking an image of the lens from each end, or ‘eyeballed’ at a reasonable level of accuracy.

As was shown in a previous post, estimating the EP, which is the pano rotation location, can be accomplished very simply using a light source. At a push, one could also, whilst on a tripod, locate the pano pivot location and measure the EP from the sensor plane directly.

Whatever approach you use, by estimating/measuring the position of the EP you can get an estimate of the location of the front principal from knowing the pupil magnification (p), ie the front principal is located at EP - F(1-1/p). Thus, even if you don’t have a model of the lens, you can consider the lens as a black box and estimate the location of the front principal, by measuring the location of the entrance pupil and measuring/guesstimating the pupil magnification.

As usual I welcome any feedback on this post or any of my posts.

Sunday, November 20, 2022

Deep Focus Bracketing Hack

As readers of my blog know, I like 'playing around' with the technical side of photography and am drawn to landscape, wide angle, deep focus image capture.

As a user of Magic Lantern and CHDK I can exploit Lua scripting to help with landscape focus stacking, for example my QDFS script that gives my M3 and EF-M lenses a depth of field scale and user feedback on where to focus stack.

But what if you are using a manual lens or a lens that doesn’t work with Magic Lantern or CHDK?

In this post I discuss a cheap and cheerful hack so you can ensure any lens can be used to capture perfect focus stacks.

Of course, some lenses are already fit for manual focus stacking: for example my Irix 11mm prime lens on my EOS-R, via an adapter, provides a very readable and useable depth of field scale:

On the other hand my Sigma 12-24 f/4.5-5.6 DG HSM II lens is virtually useless for focus stacking.

The issue with the Sigma lens is, of course, it’s a zoom and the depth of field scale is fixed.

Yes, you can work out the focal length that the depth of field scale is set at, but you will likely find it is not at the focal length you wish to use. In fact if we use a circle of confusion of 0.03, the Sigma 12-24mm lens appears to have a depth of field scale set for a focal length of about 17mm: the middle of the zoom range.

A true depth of field scale on a zoom needs to adjust to each focal length, as one sees on some older lenses:

In order to construct your own depth of field scale, at your focal length of choice, we need to first lay out a model of the lens as we don’t want to model a real lens. As always, we will make use of a thick lens model. That is a thin lens with an hiatus between the front and rear principals.

Thanks (once again) to PhotonsToPhotos we can look at the Sigma 12-24 and use the Optical Bench Hub to explore the lens:

In the above we see the front principal (H) and the entrance pupil (P), relative to the image plane (I). The distances, relative to the front of the lens, at infinity, being H, P, I = 34.2mm, 23.84mm, 137.86, at the wide end.

As we are interested in measuring focus from the front principal, the above tells us that, if we know the minimum focus distance (MFD) from the image plane, ie through accepting the manufacturer’s data or measuring it, we can estimate the minimum focus distance from the front principal, ie MFD - (137.86-34.2 = about 104mm). Note we will be ignoring lens extension in our model.

To simplify things further, we will recognise the hyperfocal distance (h) as (F*F)/(N*C), where F is the focal length, N the aperture number and C the circle of confusion that we wish to use for focus stacking. We thus can state the near (R) and far (S) depths of field estimates as:

R = (h*u)/(h+u)

S = (h*u)/(h-u)

Where u is the focus distance from the front principal.

We can then rearrange the above to derive the depth of field scales, ie:

1/S = 1/u -1/h

1/R = 1/u + 1/h

Finally, by using a scale factor (J) we can create the following model:

Where J is simply (MFD-X)*T, and T is the lens throw.

Now we have a model, let’s put it into practice.

The first thing we need to do is to measure the lens throw or rotation, between the MFD and infinity. The simplest hack to do this is to put some tape, or something similar, that will not stretch or move, on the focus ring of the lens. Having done this, rotate the lens until the left of the tape comes into alignment with the MFD. Then slowly rotate the lens until the infinity location and mark the tape. This gives us the ‘rotation length’ (L) in mm.

Remove the tape from the lens and mark the tape every 10mm, to create a scale, and replace the tape.

The depth of field can now be estimated from: ((MFD-X)*L*N*C)/(F*F).

In the case of the Sigma lens at F = 12mm, L was 73mm, X = 104mm, MFD = 250mm, N=8, and I choose an overlap C of 0.02mm.

Giving the near and far depth of field scale distances as 12mm, thus all we need to do is cut a length of tape at 24mm and place a mark at the centre. The resulting hack looks like this, which, although not shown below, in this example, is only usable at a focal length of 12mm:

To use the depth of field hack all one needs to do is first ‘calibrate’ the lens by rotating the focus ring until the MFD comes into alignment with the left hand end of the tape. Set focus on the nearest object of interest and capture an image, and use the depth of field hack to rotate the lens until you have captured your perfect focus stack.

As usual I welcome any comments on this post or any of my posts.

Saturday, October 22, 2022

CHDK Update

I'm pleased to report that the CHDK stable release has just been updated to version 1.6, and, importantly for me, the development version, which includes the XIMR based drawing, updated to 1.7.

I've thus brought QDFS into line with the CHDK development version (1.7).

The latest version of QDFS, which requires CHDK 1.7, may be downloaded from the right.

The CHDK 1.7 version may be downloaded from the CHDK development trunk: http://mighty-hoernsche.de/trunk/ and more info found here: https://chdk.fandom.com/wiki/Downloads

Thursday, October 6, 2022

QDFS: Workflow

In this post I'll provide a little more clarity on using QDFS and illustrate one of the ways QDFS can help you get perfect multi image exposure and focus bracket sets with your Canon M3.

The script has the following button mapping:

Rather than repeat what each function means, as I have described this in previous posts, let's look at how we can use the ETTL/ETTR features with focus bracketing.

Having decided the scene needs two exposures, one for the highlights and one for the shadows, eg by using the ETTR/ETTL functionality to survey the scene, the captue workflow looks like this: 

That is, after setting the Canon side for a single image and QDFS X bracketing to Canon

  • Set focus for the nearest object of interest
  • Press [RIGHT] to obtain an ETTR exposure for the highlights
  • Press [M-Fn] to grab an image
  • Press [LEFT] to obtain an ETTL exposure for the shadows at the current focus
  • Press [M-Fn] to grab an image
  • Use the QDFS depth of field scale to refocus
  • Press [M-Fn] to grab an image
  • Use the QDFS depth of field scale to refocus
  • Press [RIGHT] to obtain an ETTR exposure for the highlights
  • Use the QDFS depth of field scale to refocus
  • Press [M-Fn] to grab an image 
  • Press [LEFT] to obtain an ETTL exposure for the shadows at the current focus
  • Press [M-Fn] to grab the final image at the required infinity blur (shown on the DoF scale)

Note the above workflow may also be initiated with an ETTL.

The following test example is of a four focus bracket set, captured with the above workflow, showing the ETTR/ETTL pairs, ie 8 exposures.


After pre-processing with PureRAW 2, I first used Lightroom to create an 'HDR' merge of each ETTL/ETTR pair. I then did a round trip with the four, exposure merged, images to Helicon focus (I could have also used another focusing stacking App or even Photoshop), resuluting in an image that, after a little bit of LR post processing looks like this:

I hope the above has provided a little more insight into the functionality and power of QDFS, especially for those that wish to use a, tech/script augmented, manual approach. 

As usual I welcome any feedback on this post or any of my posts.



Sunday, September 25, 2022

QDFS: now with more functionality

As readers of my blog know, my scripts are biased towards wide angle, deep focus and high dynamic range scenes. That is scenes that require complex image capture bracket sets that benefit from scripting.

Although I have several EOSMs, which run scripts under Magic Lantern, and an EOS R, which doesn't yet run ML, my current photography is directed towards the CHDK cameras I have, and in particular the M3 and EF-M lenses.

The latest release of Quasi Depth of Field Script (QDFS), which may be downloaded from the right, now includes several features that are directed at the landscape photographer. For instance, the script will:

  • Detect if you are using Canon's three image exposure bracketing and you can change Canon setting as the script is running (see below)
  • Allows you to capture an ETTR-based, two image ISO or Tv bracket at a defined Ev relative to the base exposure, to complement the Canon three bracket capability
  • If enabled, the CHDK console will now also display the current exposure's delta Ev, relative to a reference exposure
  • A reference exposure is established at start up and whenever the Canon shutter is pressed in ALT mode
  • Pressing the INFO button toggles through the Canon display settings you have set up (your choice), including showing the screen to change various Canon settings, like the AEB and showing the Canon histogram
  • Pressing MENU button hides the QDFS graphics, ie to create a clean screen as an aid to composing
  • If enabled (Get Mag = Dynamic in the script’s menu), you can recalibrate the DoF scale in realtime. This is best accomplished by setting the focus just short of, but close to, the hyperfocal and just when the Canon upper/lower distances change and pressing SET
  • Pressing the RIGHT button will ETTR the exposure, ie set exposure for the highlights, from where you can tweak the exposure further
  • Pressing the LEFT button will ETTL the exposure, ie set exposure for the shadows, from where you can tweak the exposure further
  • The script show additional information, such the delta exposure (Ev), relative to the reference exposure, thus allowing you to survey the scene by using the ETTR and ETTL buttons
  • Pressing the M-Fn button will capture the requested exposure brackets, after which you can use QDFS to set the next focus, if required.

The following screen captures illustrate the above.


In the above we see a typical script start up view. The focus has been set to the camera's minimum focus, in this case 150mm with the 11-22mm lens, We also see DoF scale shows us where the hyperfocal is (red line), and highlights fractions of the hyperfocal, ie H/2. H/4, ...H/32 and the minimum focus. We also see in the console area at the bottom that the total lens rotation count to (data) infinity is 613 and that we are at 0, ie minimum focus.. The display also shows the Canon reported focus, ie the lower and upper values that Canon is reporting at the current focus. As we are at minimum focus, we are well away from the hyperfocal, ie at H/14.1. Finally, as we haven't yet changed exposure, the delta Ev reading is 0Ev.

In this next screen grab we see focus has been moved to beyond the hyperfocal and that QDFS now displays the infinity defocus blur in microns, 11 microns in this case at about 1.3 x the hyperfocal, as opposed to the focus distance in mm. Although not shown here, toggling the INFO button will allow you to display the Canon histogram.

As we are overexposed, it is a simple matter to press the RIGHT button and let QDFS set an ETTR exposure for the highlights, as below:

Here we see that the exposure is 5Ev from the initial exposure and at this point we press the Canon shutter, to create a reference point:

In the above we see the delta Ev has been zeroed and that the current focus, and DoF, is shown above the QDFS central scale. This reference will remain in place as we refocus, thus allowing us to return to the last focus position, as shown below: 

In the above we see the DoF reporting is red, indicating our current focus position has a focus gap relative to the last image or, in this case, the last referenced focus. We also see that QDFS is reporting we are at 352mm from the sensor plane, whereas the Canon upper and lower reporting is 360 and 400mm. So who is right? Well neither. Canon is giving us a range, where as QDFS appears not to be inside the Canon range, although is very close. For non macro DoF setting we are good enough, remember we are using a thin lens model for a complex lens design that we don’t know; but if you wanted to recalibrate you could, by moving focus until the Canon value just changes and then press the SET button. You can also tell QDFS what distance you wish use for calibration at start up, ie H, H/2 or H/3.

The final thing to show is that we can easily return to our referenced focus (yellow) and then press the LEFT button to set an ETTL exposure:


In the above we see the ETTL exposure is 5Ev away from the ETTR one. With this information we can decide how many exposure brackets we need for the scene, eg can we 'get away' with just two, the ETTR and the ETTL exposures, or do we need additional exposure brackets. 

I hope landscape photographers see the value/power of the script and in future posts I'll provide insight into the QDFS and LBS scripts with real information from the field.

As usual I welcome any feedback on this post or any of my posts.

 








Friday, August 26, 2022

QDFS: Now works with all EF-M lenses

I had a bit of a brainwave and realised I don't need to preregister lenses. Thus the latest version of QDFS, download from the right hand link, now works with all EF-M lenses: no lens registering required.

I personally find it best to put the 'Get Mag' menu to Dynamic, which means I can always fine tune the depth of field scale if required, eg near,but short of the hyperfocal.

When switched on or after, say, a focal length change, the script will carry out a lens calibration step, at a distance of a fraction of the hyperfocal, as defined in the menu. 

I recommend you always do an additional dynamic calibration yourself, at the start of each shooting session.

As usual I welcome any comments on this post or any of my posts.

Thursday, August 25, 2022

QDFS: a further refinement

After playing with the 'get magnification' option that QDFS now contains, I realised I could take the idea further and turn the feature into a more dynamic tool.

Thus the latest version of QDFS now has the following menu:

#lensmag = 0 "Get Mag" {Off On Dynamic}

If you select Off, QDFS uses the registered magnification(s) of the lens.

If you select ON and, at your focus reference, press SET, you will get on screen feedback on the magnification (make sure the console is switched on in the QDFS menu). This magnification can then be to used in the QDFS script, meaning that the Canon distance reporting, from the sensor, comes into alignment with QDFS distance reporting. Note, that with this option the magnification doesn't change until you change the value in the script.

The new, Dynamic, option gives you full control over QDFS in real time, such that you can dynamically decide to align QDFS and Canon at any distance, and the magnification that is needed will get used instantly, ie you will see the change.

This feature is of value when, say, you focus on a subject and wish to know the focus distances either side of the point of focus. Having dynamically set the magnification in the QDFS model, the distance feedback will be the 'best you can get'.

Anytime you use the feature, make sure you stop focusing just as the Canon lower (L) reporting in the console changes.

If you are doing deep focus stacking, I recommend you calibrate at or just short of the hyperfocal.

So, like a stopped watch, that is always right twice a day, QDFS focus distance reporting from the sensor and Canon's reporting from the sensor are always the same at two focus distances: the minimum focus distance and at the calibration distance. In between QDFS uses a thin lens model to estimate the focus distances from the sensor: noting that lens extension is not modeled ;-)

As usual I welcome and feedback on this post or any of my posts.