Saturday, September 19, 2020

DOFIS: Indoor Test of 32 bit Focus and Exposure bracketing

It's a windy day outside and the pestilence remains with us in the UK. So, in this post, I'm going to talk through an indoor test of using DOFIS in full auto exposure and focus bracketing modes.

My use case is a high dynamic range scene, for example, in a cathedral, where I also want to capture the details from the nearest focus to a blur informed infinity, ie beyond the hyperfocal. But in this post we will have to make use of our library.

Having composed my shot, I first placed the ML RAW Spotmeter in the area where I wished to see shadow details: the book in this test. 

Having done this, I then used the ML ETTR functionality to set the base exposure and noted the spotmeter reading of -9.5EV, which I rounded to -10Ev.

I decided to place the shadows no lower than 2 stops down from the 18% grey zone, ie Zone V, which is at -6Ev down from ML's 0Ev.

These were the DOFIS Menu settings I used in this test:

We see that: I have selected Full auto focus bracketing; that diffraction aware is on so DOFIS will calculate the defocus CoC (I had set a CoC of 30 microns in ML, ie the total blur in DOFIS); the spotmeter value has been entered as -10Ev; I'm using an exposure bracketing step of 2Ev; I'm telling DOFIS to bracket until the shadows (where the spotmeter is placed) are greater than -6Ev; and, after I trigger things with my selected button (the RATE key on my 5D3), inject a 2 second delay before taking the first image.

BTW we also see that the diffraction aware, hyperfocal distance, from the sensor, as calculated by the DOFIS split lens model, is 75cm. Note that the Lens Model is showing OK, ie we are using a registered lens, thus the magnification at the minimum focus will match the manufacturer's or measured value.

All I then needed to do then was put the aperture at f/8, the ISO at 100 and the 12mm lens to its minimum focus, ie 28cm from the sensor, push the RATE button, and watch DOFIS do its magic: giving 12 images, ie 4 exposures at three focus positions.

ML gave the ETTRed base exposure as 1/40s, and DOFIS decided it needed three more at: 1/10s, 0.4s and 1.6s. 

As for the focus positions: the first, of course was at 28cm, but what about the other two? Using Jeffrey Friedi's Metadata plugin in Lightroom, gave me access to the EXIF from within LR, with the Canon reported, lower and upper focus distances, as:

  • Image 1: 0.28m/0.28m
  • Image 2: 0.43m/0.45m
  • Image 3: 1.51m/2.19m

The final image being focused over twice the hyperfocal, ie giving an infinity blur of under half of that of an image taken at the hyperfocal.

As for post processing, I wanted to maintain a 32 bit process throughout, so the first step was to create a 32 bit DNG master file at each focus position, ie giving me +/- 10Ev processing latitude in Lightroom. 

In the Library Grid mode, I simply selected each of the 4 exposures and pressed Alt G, thus stacking them. This gave my three stacks that I highlighted and processed in LR with Photo Merge to HDR.

I then did a round trip to Helicon Focus with these three 32 bit DNG images, using Method B in HF to focus stack the 32 bit images.

After returning to LR from HF, I finally tweaked the resultant, exposure and focus stacked 32 bit image: giving this final 'test shot':

An alternative approach would have been to send the 32 bit image to Photoshop, and duplicate this, thus giving me two layers to blend, eg with luminosity masks, ie one for the shadows and one for the highlights.

I hope this post has illustrated the power of DOFIS to those photographers who are seeking the optimum capture for deep focus scenes with or without high DR content; as in a cathedral, say; and wishing to maintain a 32 bit workflow throughout, ie +/- 10Ev exposure range in Lightroom.

As usual I welcome any feedback on this post.

Friday, September 18, 2020

DOFIS: perfect focus and exposure bracketing for photographers

Those that have been following my DOFIS developments will know that I’ve been evolving DOFIS to be the single script that I have running for all my EOS photography needs. That is, helping me achieve blur-informed, infinity focus, and carry out scene-informed, automatic/semi-auto/manual focus bracketing with ML or DOFIS advanced exposure bracketing.

Although DOFIS started off as a script to provide 'just' focus bracketing information, it has now evolved into a powerful tool for all photographers: and, dare I say, videograhers, where DOFIS can show you ‘correct’ relative or absolute DoFs.

Because of limitations within Lua, accessing the ML advanced (exposure) bracketing (AB) can only be accomplished via the semi auto focusing option, ie up until now you could not auto exposure bracket in full auto focus bracketing mode.

This restriction has been bothering me, hence I’ve now incorporated my own auto exposure bracketing scheme within DOFIS, which you can access in full focus bracketing mode, as well as when focus bracketing is switched off.

The new auto exposure bracketing option is based on exploiting two of Magic Lanterns most powerful photography features, namely, RAW-based auto ETTR and the RAW-based Ev-based spotmeter; and adapting the ideas of Ansel Adams and Fred Archer, from their film-based Zone System. 

Of course in digital photography we expose for the highlights and process (and potentially bracket) for the shadows; which is just the opposite of the classic Zone System rule for film photography, where we expose for the shadows and develop for the highlights.

To optimally use the new auto exposure bracketing feature, you need to enable the ML RAW Ev spotmeter in the Overlay menu, plus, ensure that Auto ETTR highlight ignore is set to 0, and that the two SNRs are OFF.

The following chart illustrates how the various exposure and focus bracketing options interact, noting that DOFIS allows you to exposure bracket without focus bracketing. 

The DOFIS auto exposure bracketing feature is based on a modification of the classic zone system, where the usual zone IX, ie where we would expect to see specular highlights etc, is the ML spotmeter zone 0 in DOFIS:

Thus the zone system’s 18% grey, zone V, where a camera normally tries to meter at 0Ev, can be assumed to be the ML spotmeter 'zone', -4E to -5Ev.

The updated DOFIS menu now looks like this:

Here we see four new menu items, related to exposure bracketing. The first menu item allows the user to enter the RAW EV (integer) spotmeter value from the shadow region of the image where you wish to see details. In DOFIS all you need to know is how many stops down from the highlights do you wish to place the shadows, eg -6Ev, say.

As an example, after ML ETTRing, we see the ML RAW EV spotmeter, in the area of the image we are interested in, reads -8.7Ev, so let’s say this is -9Ev. We wish to ensure this is two stops below middle grey, which in the normal zone system is zone III, thus we wish the shadow area to end up at -6Ev, ie zone III. We thus enter this value in the Shadow Ev in DOFIS.

The third menu item that controls the DOFIS exposure bracketing is the Ev delta value, ie the bracketing Ev step. A zero here, as above, switches the exposure bracketing off. Active values are 1 through to 4. A value of 4Ev giving you the option of carry out, so-called, zero noise bracketing. Typically one would use 1Ev or 2Ev steps, ie for tonal smoothness.

Finally, you can introduce a delay of 0, 1 or 2 seconds, after initiating the DOFIS exposure bracketing, ie, like focus bracketing, after pressing the trigger key that you have set in the script.

In future posts I aim to provide examples of how I’ve used the latest DOFIS script in the real world. Until then, as usual, I welcome feedback on this post and any hearing about other users' experiences with DOFIS.






Thursday, September 10, 2020

DOFIS: now helping the Landscape photographer even more

Magic Lantern is an incredible piece of software technology, giving Canon EOS photographers and videographers things that Canon 'forgot' ;-)

As mainly a landscape photographer, I personally find the following to be an essential part of my workflow:

  • Dual-ISO for those shutter sensitive high DR situations;
  • Auto exposure bracketing for all other high DR situations;
  • RAW-based Auto ETTR;
  • RAW-based Ev spotmeter;
  • Lua scripting, for taking ML beyond the base ML functionality, eg using DOFIS.

In the latest version of DOFIS I've added an option, under the semi auto focus mode, to drive the lens to the hyperfocal, well one lens focus step over the hyperfocal. You now have two options. 

Semi(dx) moves the lens to the next focus bracketing station, as long as you are focused at less than the hyperfocal; the final move being to the hyperfocal, ie ready for an additional, manually focused, infinity shot if you wish.

Semi(H) will move the lens to just beyond the hyperfocal, ie as near as the lens move resolution allows: the caveat being that the movement/position resolution towards infinity fails of sharply. 

Tip: dial in the ML CoC you wish to see as an infinity defocus blur, switch off diffraction aware in DOFIS, and use the Semi(H) option. You now have the ability to drive the lens to the infinity defocus blur that you wish.

Thus, for example, on my 5D3, where I use the RATE button as my DOFIS trigger button, all I need to do is push the RATE button and the lens will automatically move to the hyperfocal, irrespective of where it started. But as mentioned above, lens position resolution towards infinity means you will may not be able to achieve your desired outcome, especially for longer focal lengths. 

Once at the hyperfocal, you can then see what DOFIS is telling you about the near depth of field, and defocus, diffraction and total infinity blurs. Thus allowing you to decide what to do next, eg capture an image or refocus further towards infinity, ie for a higher focus quality (lower blur) at infinity, albeit at the cost of a reduced near depth of field.

This new feature is set in the DOFIS menu, under Auto Bracketing options.

As usual I welcome any feedback on DOFIS, especially from other users.

Wednesday, September 9, 2020

DOFIS: a bit of refactoring

A short post to say that I've refactored DOFIS and added more comments to the script.

Sunday, September 6, 2020


In previous posts I've restricted my DOFIS remarks to my 5D3. In this post, I'll say a few words about DOFIS and the EOSM.

As long as you are running an ML build with the latest Lua fix module, DOFIS should run on your ML enabled camera, but there are caveats.

For example, on some EOS/EF-lens cameras, DOFIS auto mode may be (very, very) slow, eg relative to, say, how DOFIS moves lenses on a 5D3.

As for the EOSM, DOFIS will run on the EOSM, ie giving you DoF feedback etc,  eg I have it running on my IR converted EOSM, but ML Lua can not drive an EF-M lens; and, although it will drive an EF lens, my experience is it is not usable, ie way too slow.

I suggest that when you register a lens on the EOSM, either EF-M, EF or EF-S, you disable the drive, as below, ie:

--Lens #3
mylens[3] = {}
mylens[3][1] = "EF-M11-22mm f/4-5.6 IS STM" -- lens name
mylens[3][2] = 0.3 -- Mag
mylens[3][3] = 150 -- FD
mylens[3][4] = 22 -- FL at Mag (use longest FL on a zoom)
mylens[3][5] = 0 -- ML can't drive EFM lenses

I therefore recommend that you do not use any auto focus bracketing, ie full or semi, on the EOSM, or any camera that sluggishly drives lenses. That is, just use the DOFIS manual focus bracketing feedback and switch the auto focus to off and/or set the registered drive direction to zero.

As an example of what can be done with DOFIS on the EOSM, here is a focus bracket test I just took with my IR converted EOSM. 

I set the aperture to f/6.3, to minimise the diffraction as much as possible and stay in the lens 'sweet spot', I used ML to ETTR to 1/30s at ISO100. I used diffraction aware in DOFIS, with an ML CoC set to the standard (APS-C) 19 microns.

I focused near the minimum of the lens and DOFIS indicated I would need 9 focus brackets to get to the hyperfocal. In fact, doing manual focus bracketing, and backing off until DOFIS showed a positive focus overlap, I ended up taking 11 images, including an infinity shot.

I ingested the images into Lightroom, prepped them for focus stacking, did a round trip to Helicon focus, and toned the stacked image back in Lightroom:

As usual I welcome any feedback on DOFIS.

DOFIS: Now works with ML Advanced Bracketing

In this post I'm releasing the latest iteration of DOFIS, which is now compatible with Magic Lantern’s Advanced Bracketing.

To achieve this compatibility, I've introduced two auto focus bracketing modes. 

The full auto focus bracketing will focus bracket, from x (x<H) to H, and take a single image (Dual-ISO or not) at each focus station. DOFIS will disable advanced bracketing in this mode.

The semi auto focus bracketing will 'simply' refocus the lens to the next focus position towards infinity, as long as you are focused less than the hyperfocal (H). In the semi auto mode you can thus use ML advanced bracketing, or Canon bracketing.

As before, pressing the trigger key (I use the RATE key on the 5D3), will start the selected focus bracketing.

A word of warning, as we are using focus models. The equations begin to breakdown at longer focal lengths, as the Canon focus resolution feedback, that ML uses, becomes too coarse. For this reason I've built in a warning flag at focal length of 50mm or greater (when full auto focus bracketing), that shows you the number of brackets that DOFIS is estimating. But, it is only a warning ;-)

In full auto mode, DOFIS attempts, but it’s not perfect, to manage the errors that may occur at longer focal lengths. Thus if DOFIS prematurely terminates auto focusing with an error beep, it is likely because the focal length is too long.

In either full or semi mode, if your lens starts doing 'wacky stuff', simply switch off the camera and rethink what you are doing.

The new menus look like this:


In the top image we see DOFIS is alerting you that you may be using too long a focal length for focus bracketing, ie you are greater than 50mm, and DOFIS is alerting you that you will be taking around 36 focus brackets. As I say, it's your choice ;-)

In the bottom menu we see the new semi auto focus bracketing mode has been selected and that DOFIS is reminding you what the trigger key is.

In the semi auto mode, every time you press your trigger key, the lens will be re-positioned to the next focus position, where you can carry out any capture sequence you wish, eg exposure bracketing.

The new semi auto focus mode should be a feature that every landscape photography leaves on.

As usual I welcome any feedback on this post and DOFIS.

Friday, September 4, 2020

DOFIS: Tidying things up

[This is an edited version of the original post, as I had second thoughts on something]

First, a few words on the thin lens model, eg like the one that is built into ML.

The thin lens model is a reasonable model with which to calculate the depths of field, once you are away from the macro end.

The main disadvantage of the thin lens model is that its distance zero, ie positioned at the lens front principal plane, is at f*(1+m) or, put another way, at f+focus_extension, where f is the focal length, m the magnification and focus extension is f*m.

As we can see, at infinity, m is zero, and thus the lens extension is zero.

In ML, the front principal of the thin lens model is positioned at the focal length, ie the ML thin lens model assumes you are always focused at infinity, ie there is no lens extension built in.

Now, to be fair, the lens extension is usually small, especially for wide angle lenses, ie  the magnification x the focal length (mag*f). Thus, my 12-24mm Sigma, at 24mm, the maximum magnification (at the minimum focus distance) is 0.156 (which is what is registered in DOFIS). Therefore the focus extension is 0.156*24 = 3.744mm. In other words, hardly worth worrying about when doing non macro photography.

But what if we attach a 100mm macro lens, with a minimum focus distance (MFD) of 300mm (from the sensor plane) and try and use the thin lens model. Simply put, the model doesn't work and the thin lens equation fails us; for example, unable to work out the maximum magnification.

For this reason, when using DOFIS, I recommend you use the Auto lens model and register your lenses with measured/trusted lens data. With the Auto lens model on and the 100mm Macro correctly registered, we see the following, where the maximum magnification at the MFD is being correctly calculated and reported:

If we tried using the 100mm Macro lens with a standard thin lens model, you would not see the correct magnification at the minimum focus distance. The reason being, the thin lens model breaks down when the focus distance is less than 4 x the focal length, ie in the case of the 100mm Macro, at 400mm. Thus when the lens focuses at its minimum of 300mm, the thin lens model fails.

Although in general the thin lens model will never give you the correct magnification, hence the reason for the split lens model, it fails catastrophically in the case of a near field focused macro lens.

DOFIS attempts to fix this by forcing the magnification to 1 if the focus distance is less than four times the focal length. Thus, if a thin lens model is selected in the case of the Canon 100mm macro, you will see a magnification of 1 at the minimum focus distance.

To be clear, DOFIS is still using a thin lens model with a front principal fixed at the focal length, but it is now including lens extension, based on the thin lens magnification model, throughout its focus range, ie f(1+m); where m varies with focus.

This release of DOFIS (download from the right) also includes a reminder as to the auto bracketing key you have set. You need to explicitly add this in the script, eg:

button = KEY.RATE -- change as required           *
button_t = "RATE" -- add a 4 letter reminder here *

With Auto Bracketing switched on, we now get a reminder of the key to use:

Finally, this version includes a few code tweaks to tidy up my scripting.

As usual I welcome any feedback on DOFIS.