Friday, August 5, 2022

Quasi Depth of Field Scale in Action

UPDATE:  although the QDFS script works, unfortunately I recommend you not use it for now. The reason is related to how some of the calls interact with the Canon side. The problem has been recognised by the CHDK developers and I’m hopeful a fix will be implemented soon.

In the last post I introduced the Quasi Depth of Field Scale (QDFS) script (latest version on the right) that I wrote to aid manual focus bracketing. The script has been written mainly to cover focus bracketing for wide angle lenses, and has been tested on the EF-M 11-22mm.

The reason for the WA warning is that, once you go move away from the WA zone, the number of focus brackets you need to take gets large for deep focus scenes. In such cases it is better to use an automatic approach, for example my Landscape Bracketing Script.

In this post I’m demonstrating QDFS’s functionality in three short videos.

This first video shows QDFS starting up and how the in-bar information is handled:

If you are focused short of the hyperfocal, then QDFS shows (on the right) an estimate of the number of focus brackets to get from your current focus position to the hyperfocal; where you can add in an infinity bracket.

If you are focused beyond the hyperfocal and short of infinity, QDFS shows (on the left) an estimate of the infinity blur in microns.

If you are focused at infinity, QDFS shows four pieces of information: the circle of confusion in microns; the minimum focus distance (MFD) in mm (from the front principal);  the hyperfocal distance in mm (from the front principal); and the total number of brackets required from the MFD to the hyperfocal.

BTW because QDFS shows the Canon reported distances in the console area, if switched on, we now have an estimate of where the front principal is located, relative to the sensor. Namely, at the MFD reported by Canon, minus the MFD reported by QDFS. In the video above, the MFD, relative to the front principal is reported as 93mm. In the above, knowing the Canon reported MFD, relative to the sensor, is 150mm, means an estimate of the front principal, relative to the sensor, is 150-93 = 57mm. A better estimate than using the thin lens position; in this case, at F(1+m), ie 11(1+0.3) = 14.3mm.

In this next video we see how QDFS handles changes in focal length and aperture. Focal length changes result in a recalibration, whereas changes in aperture are handled dynamically in real-time:

Finally, in the last video we see focus bracketing taking place in QDFS:

Finally, pressing the INFO button will toggle the depth of field scale on and off, ie to support composing.

Bottom line: if you are lucky enough to have a Canon M3 (M10 or M100) that is running CHDK, you may wish to give my QDFS script a try out.

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

Sunday, July 31, 2022

Depth of Field Scale for Focus By Wire Lenses

Moderm focus by wire lenses are, at first sight, a great idea, but only if the camera matches the technology: which, unfortunately, it doesn't always.

For example, the technology built into the lens to control focusing via wire, eg a stepper motor, doesn't, in the case of Canon, match the UI in the camera, ie there is no or little focus information displayed to help the photographer with, say, focus bracketing.

But it gets worse, as on, say, the EF-M lenses we not only don't have focus feedback via the camera, but we are also missing a depth of field scale, like the good old fashion one shown below:

So I thought I would write my own DoF Scale for the Canon M3 running CHDK. 

The use case is that I'm doing landscape photography and I have a deep focus scene, ie one I can't capture in a single image. In this case the challange is knowing where to focus bracket.

The Quasi Depth of Field Scale (QDFS) script is designed so I can manually focus bracket whenever I need.

The full, base model looks like this (but the script uses a simplified version):

As we are not doing macro photography, and magnification is going to be ‘low’, we can simplfy things a bit, eg assume a symmetrical lens with a pupil mag of unity.

Thus, to create the DoF scale, shown at the bottom right of the above model, all we need to know is the minimum focus distance (M) and the object distance u, both referenced from the front principal.

Rather than attempting to model the actual lens mechanism, we will assume a simple lens focusing arrangement that results in a lens extension F*m, where F is the focal length and m the magnification at u. 

As said above, focusing from the MFD to infinity is achieved by manually rotating the lens, which in this case we track by noting the stepper motor reported position, which we can get from CHDK. As an aside, the stepper motor movement model (every 10 steps) looks like this (F=11, m=0.13, C = 525):

Thus we have a simple equation to solve for u, the object distance from the front principal:

Where C is the maximum stepper motor count at ‘infinity’, n the count at the current focus and m is the magnification at the minimum focus distance, giving us:

Putting n = 0 will give us the model's (sic) minimum focus distance (M), ie in object space, relative to the model's front principal.

A word of caution. QDFS was written to aid focus bracketing. The lens model is not an exact replica of the lens in your camera: it's a model. If used for focus bracketing, including infinity focusing beyond the htperfocal distance, it will serve you well. If you use to, say, set a singe focus at the calculated hyperfocal, you will likely be out by a few counts. So, if hyperfocal focusing, always focus slightly beyond the hyperfocal and be informed by the QDFS's hyperfocal reporting and the sensor plane based, Canon reported focus distances.

The magnification at the MFD may be measured or taken from the manufacturer's specifications. Zoom can be handled by asuming a linear interpolation between the two zoom extremes, ie accounting for the possibility that the MFD may be different at the zoom extremes.

Plugging the above into the Depth of Field scale model, ie (1-M/u)*k, where k is the scaling for the screen display, we now have a Depth of Field scale for the focus by wire EF-M cameras that run CHDK Lua scripts.

The QDFS (Quasi Depth of Field Scale) script can be download from the right.

As I said above, I wrote QDFS specifically for the 11-22mm EF-M lens, and I would advise not using the script for anything other than a wide angle lens.

The QDFS UI is simple, but, I believe, effective. The scale runs the width of the screen and shows fiducials at the hyperfocal (H), H/2, H/4, H/8, H/16 etc; but you can easly adjust these in the script, eg showing the odds (H/3, H/5, H/7...) or the evens (H/2, H/4, H/6...).

When first run, the script carries out a lens calibration, and does this whenever the focal length changes. The calibration finds the lens stepper motor minimum and maximim counts and the position where 'Canon Infinity' oocurs, ie beyond this count Canon only reports a maximum number. This is needed as some lenses 'max out' before the stepper motor does, like the 11-22m.

The script's menu only has two entires. First the Circle of Confusion you wish to use to set the (overlap, or infinity blur) hyperfocal. Second the option to switch the console on to see some additional data.

With the console switched on, the QDFS UI looks as follows (note the console offset, to the left, is an artifact of the HDMI recording):

Here we see the DoF scale (white bar) running from the minimum focus to infinity. We also see the hyperfocal marked (red line) and fractions of the hyperfocal (H/2, H/4, H/8 etc).In the screen grab above, at a focal length of 11mm, a CoC of 20 microns and an aperture of F/8, we can just see the H/8 line.

The lower (grey) bar shows the near and far depths of field, either side of the point of focus. This bar will, of course, change in size according to the focal length, aperature and CoC.

The console area shows two lines of information. The top line shows info on the actual stepper motor (max, near and far) counts, and the hyperfocal (from the front principal, ie not the sensor plane)  in mm.

The bottom line shows the current stepper motor position relative to the zeroed MFD, and the Canon reported lower and upper focus distances, relative to the sensor plane.

To illustrate QDFS's functionality, let's take an image at the current point, which represents the nearest object of interest in our scene. Image capture is achieved by using the M3's M-Fn button. We now see the following:

A top bar (blue) now appears and shows the last image's position and depth of field. The focus bar (lower) has turned yellow, indicating that we are still positioned exactly where the last image was captured. We also see the count at the captured image’s location. If we now move focus we will see something like this:

Here we see the focus bar has changed to green, indicating we have a positive focus overlap. Focusing further we see the following:

In the above we see a focus gap has opened up and the focus bar has turned red to emphaisis this. Clearly, in this case, we would reposition for the next shot and, once taken, the screen would look like this:

The QDFS script was written to provide a depth of field scale for manual focus bracketing. I've kept the UI simple, but I welcome any comments on additional functionality.

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

Friday, June 24, 2022

Skies and InfraRed Photography

I know that not everyone likes infrared photography, I think mainly because of the many 'false colour' images that are published. 

Some have called IR photography rather Marmite like: you either hate it or love it.

However, as I've said before, IR is your friend during the mid-day period and if the skies look 'dead': like today around noon, when I snapped this test image in our garden.

In the visible bands the sky was white and rather flat. But in the IR the sky was incredible.

Here is the test image:

It was captured handheld with my IR converted EOS M, with a 7.5mm fisheye lens, set to an aperture of f/8, and ISO100, and an ETTR shutter at 1/30s.

As for post processing, this was accomplished in Lightroom, using a couple of presets that I had set up to exploit the new adaptive filters.

For example, I have a preset called Sky & Ground. One press of this preset creates two masks: one for the sky and one for the ground, with the masks adapting to each image: thank you Adobe.

I then toned the two masked areas and the overall image, for example, using the HSL sliders as well as the calibration sliders.

It’s not a work of art, but it shows what IR can accomplish, when a visible band image simply wouldn’t work.

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


As a further example of what can be achieved, the following test image was taken with the IR converted EOS M attached to an Irix 11mm lens, locked at its f/8 aperture, via the lens twist trick, and attached to a Rhinocam Vertex adapter, that allowed me to capture a 5658 square pano image after cropping, ie some 32 Mp.