Saturday, August 15, 2020

Welcome to the Family

For those that are new to my (strange) world of looking at the technicalities of photography, this post may be of some value, as I'm going to reiterate an old message.

Namely: buy secondhand, at least for your second or B camera.

For me, I have three three lines in my camera family:

  • First, my main (A) camera, a 5D3, running Magic Lantern
  • Second, my IR converted EOSM, once again running ML (not shown below)
  • Third, my collection of Canon cameras running CHDK

In this post I'm going to focus mainly on the CHDK family, that is:

  • S95
  • G7X
  • G5X
  • G1X
  • EOS M3 (with interchangeable lenses)

This happy family looks like this, next to the 5D3 with its Sigma 150-500mm lens:

Straight away, I think you can see why I've explored the CHDK enhanced Canon P&S and EOS M3 cameras: size, weight and (2nd hand) cheapness. 

The 5D3 above is over a 7lb beast!

As for weight in your wallet, you can get a secondhand Canon G5X for around £300, or the older, larger sensor, G1X at less than £200. All bargains, if you are looking for a B camera with some unique capabilities, like perfect automatic focus and exposure bracketing, via my 'Get Brackets' CHDK Lua script.

As an example, this (test) image, taken for this post, shows the power of the G5X, with its minimum 50mm focus distance. This focus bracketed image, consisting of 12 focus brackets up to a third of the hyperfocal, ie from 50mm, and two additional focus brackets for the far field. One at the hyperfocal and an infinity shot at 4 times the hyperfocal. All captured automatically via the in-camera Get Brackets script.

So, I repeat the message, irrespective of what A camera you have, eg Nikon, Sony or Canon etc, if you want to capture some unusual, deep focus, images, and have some fun, think about buying a secondhand Canon P&S camera. For example, a G7X, or a G5X or a G1X: all self contained and all waiting to benefit from my 'Get Brackets' script.

Tuesday, August 4, 2020

Close enough!

This short post is to draw a line under the current phase of my focus bracketing scripts.

Previously I spoke about the M3 version (download on the right) and in this post I cover  the non-M3 version, that I personally have tested on an S95, G1X, G5X and G7X.

The script ('Get Brackets" on the right) now seems pretty robust from a focus perspective, ie near to far. Also the exposure bracketing options will, hopefully, cover all needs. I personally use the Auto mode, ie expose for the shadows and let the script cover the highlights.

The test image below, shot at f/4, is a table top capture, where I focused just in front of the 50p coin. BTW a tip is to focus on the tip of a pencil or a key, where you wish to start the focusing. This is usually better than using the full focus range option, as this will result in many more images.

The script decided to capture 12 images, which included one at the hyperfocal and an infinity shot at three times the hyperfocal, ie at an infinity blur of 1/3 the CHDK CoC.

Finally, to illustrate how the script works, here is an animation from the Helicon Focus processing of the focus brackets, showing how the focus builds up through the scene.

As usual I welcome any feedback on this post.

Sunday, July 26, 2020

A Credit Card based Generalised Focus Model

Those that follow my blog know that I tend to bias my posts towards the technical side; in other words, my artistry as a photographer is still a 'work in progress'.

In particular I'm always trying to get the best out of Magic Lantern and CHDK Lua scripting.

One area I've thought about a lot is focusing and, in particular, 'landscape deep focus' photography; where the depth of field exceeds that of a single image, leading to focus bracketing.

In previous posts I have spoken about single image, landscape captures, where one will be focusing beyond the hyperfocal in order to ensure the required infinity blur and maximise the near depth of field (DoF).

If this is your objective, then focusing is pretty simple.

If, however, you wish to focus bracket, then you face the challenge of trying to calculate where to focus your next shot. For example, the following chart shows how the point of focus changes radically over the scene; compared to macro focus bracketing, where the near and far DoFs are existentially the same and very small:

However, there are a few assumptions buried in the above that begin to create problems as we creep towards the macro end, ie less, say, than H/5 or H/7.

That is, that the hyperfocal and the DoF equations are all measured from the lens front principal plane: which we don't know.

In fact things are worse than this, as we also don't know the lens design and make use of a Thin Lens model, which, away from the macro end, is 'good enough' for calculating the DoFs of a single image capture. 

However, the above lens model fails as we approach the macro end. This is easy to test with manufacturers' or measured data. That is, the maximum magnification at the minimum focus distance can not be calculated with the standard Thin Lens model.

Try it ;-)

The only distance we know for sure is that from the sensor to the object distance, for example Magic Lantern and CHDK Lua tell us this distance; or we can measure it.

As discussed in a one of my previous posts, a better approach is to adopt a split lens model of the thin lens, but pragmatically assume a symmetrical design, ie ignore pupillary magnification.

We can then use the above model to estimate the lens 'thickness' (t) at any particular focal length and use this to match the true magnification, ie:

Where M is the magnification, X the (sensor to object) focus distance and F the focal length.

As an example, let's take the EOSM 11-22mm lens. The stated maximum magnification, at 22mm, is 0.3 and the minimum (sensor-2-object) focus distance is 150mm, which leads to an estimate of the lens thickness of 26mm.

Knowing the lens thickness means we can then calculate the object distance u.

Using the split lens model, and setting q = x - t, we can show that the distance from the front principal to the object, ie u, is:

This distance, of course, is now referenced to the front principal plane, as is the hyperfocal and all the DoF equations.

So all is now well with the World :-)

But what about the thickness (t) at 11mm? Or some other focal length where the manufacturer doesn't tell us the value of M. What if you don't trust the manufacturer's published data?

In order to measure the lens thickness, at any focal length, I have created a simple process based on a very accurate fiducial marker that we all carry in our pocket: namely a credit card.

The international width of a credit card is 85.6mm. The process to calculate the lens thickness of an 11-22mm zoom lens is simple and requires no images to be captured:
  • Place the credit card in front of the camera and try and get the CC parallel to the sensor.
  • Use the camera's grid, say the 3x3 grid, and position the camera so the CC's width touches the 1/3 grid points:
  • Ensure the camera can focus on the card, ie you are not less than the minimum focus distance, and measure the distance between the card and the sensor's plane, ie using the mark that is usually on the camera or estimating the sensor's position. In this case the distance was 325mm.
  • Finally the lens thickness can be estimated from the equation for t above, by noting M = W/(85.6n), where W is the sensor's width in mm, ie 22.3mm for our APS-C cropped EOSM sensor, X is the measured distance, n is 3, ie if you used the full sensor width for your measurement n would be 1, and F the focal length you are measuring for. 
At 22mm this gives us a lens thickness estimate of 25.7mm, which tallies almost exactly with the Canon-based data, ie 26mm.

If we now carry out the same procedure at 11mm, we measure an X of 205mm, giving a lens thickness of 55.3mm at this focal length.

We now have everything we need to ensure the best estimate of the distance from the lens front principal to the object, based on knowing the sensor to object distance and making a very simple measurement. Thus all the optical calculations, focus, H and the DoFs, are all based on the same zero: the split lens front principal plane.

In future posts I'll will show how the above gets used in my Lua scripts, to carry out focus bracketing.

Finally, as usual, I welcome feedback on this post.

Sunday, July 5, 2020

Quick update on Deep Focus Photography

As I'm still shielding, because of C19, and am also recovering from a broken leg and surgey, I thought I would take a quick relook at my auto deep photography experiments.

Currently I have auto deep focus capture running on the following cameras:
  • Canon G1X - via a CHDK script
  • Canon G5X - via a CHDK script
  • Canon G7X - via a CHDK script
  • Canon EOSM3 - via a CHDK script
  • OMD EM5II - via the in-camera functionality
I'm going to ignore the OMD in this post,  as it relies on a propriety solution, and is not optimised for landscape deep focus capture.

The G5X and G7X have the smallest sensors, both using a "1 inch" format sensor, with the G1X upping the size to "1.5 inch" format.

This leaves my EOSM3 camera as the only APS-C format that runs one of my CHDK auto focus bracketing scripts. The latest version of the script can be downloaded from the link on the right: M3 Brackets. 

Once you have CHDK running on the M3, the script is simple to use, with the following UI:
  • Select the focus bracketing logic, ie OFF allows you to 'just' exposure bracket; X2INF focus brackets from the current position to infinity; and Min2INF covers to entire focus of the lens, irrespective of where you are focused;
  • Select what ETTR-based exposure bracketing logic you wish to use at each focus bracket. The options are: none or +4Ev or +3Ev or +2Ev or +2/+4Ev or ISO1600. Alternatively, for the M3 version, use Auto and set the base exposure for the shadows. The script will then take as many +2Ev exposure brackets as required;
  • Select your infinity focus, ie the last shot in the bracket sequence, at the overlap defocus blur divided by either 2, 3 or 4;
  • Select the overlap defocus blur in microns, between 5 and 20, with 15 being a reasonable number to use on an APS-C sensor;
  • Select if you wish to use a start delay time in seconds;
  • Select whether you delineate the bracket sequence with dark frame 'bookends';
  • Select whether the LCD is off during capture;
  • Select a so-called nudge distance to ensure the script doesn't freeze at the macro end. The default is 10mm;
  • Select a lens thickness to be used, in the split thin lens model, if you haven't explicitly coded a lens into the script. The script has the 11-22mm lens encoded, but you can add other lenses. Unless you know what you are doing, leave the lens thickness at zero and use a thin lens model;
  • Select 'Get Lens Name' to allow you to programme your own lens thickness.
As to some test results, I set the 11-22mm to 11mm, F/7.1 and ISO100, at an exposure of 0.5s. I used the Min2INF option and the script took 13 images, which I post processed in Lightroom, with a round trip to Helicon Focus.

Using Jeffrey Friedl's Lightroom “Metadata Viewer” Plugin, it was easy to extract the following (lower) focus distances from the EXIF data:
  • 0.15m
  • 0.16m
  • 0.17m
  • 0.18m
  • 0.19m
  • 0.21m
  • 0.24m
  • 0.25m
  • 0.33m
  • 0.45m
  • 0.71m
  • 1.54m
  • 3.84m
The resultant, deep focus, 'post processed' image looks like this:

Hopefully this short post has illustrated the power of CHDK to automatically create deep focus images on an APS-C cropped sensor, ie the EOSM3.

As usual I welcome feedback on this post.

Thursday, June 11, 2020

Hyperfocal Informed Bracketing Strategy

If you have been following my previous posts on using the Rule of Ten to inform your (non macro) focusing, you should now have a good understanding on how to:
  • calculate the hyperfocal using the Rule of Ten;
  • set a specific infinity blur and maximise the near depth of field for a single shot;
  • select the overlap blur using the equivalence rule;
  • carry our focus bracketing using the odds or evens rule.
In this post I'm introducing a pragmatic focus bracketing strategy, designed to be easy to use and robust enough to handle deep focus situations.

The Hyperfocal Informed Bracketing (HIB) strategy is based on knowing/calculating a single number. Namely the hyperfocal distance; either explicitly knowing it, estimating it from the DoF scale of your lens, or using the RoT to estimate it.

The HIB approach assumes you are focused on the nearest point of interest (POI) in your scene and you want the scene out to infinity to be in high quality focus.

In general, according to where your (nearest) POI is, relative to the hyperfocal, all you need to do to focus bracket for the near field, is to keep doubling the distance, until you are beyond H at which point you should select your final infinity shot.

If your POI is positioned beyond H, then all you need to do is take a single image at your selected infinity position, eg from, say, 2H to infinity.

If your POI is positioned between H/2 and H, then all you need to do is take the POI image and an infinity shot.

If your POI is positioned between H/4 and H/2, then all you need to do is take the POI image, refocus to double the POI and take a second shot, before adding a third infinity shot.

Finally, if your POI is less than H/4, then take three near field images at the POI, double the POI distance and four times the POI, ie double the second shot's distance, before taking a fourth infinity image.

Note that when the POI is less than H/4, the HIB strategy is strictly not fully optimum, but it is close enough That is pragmatism rather than mathematical purity.

To help you understand and practice HIB based focusing bracketing, I have created another eClass, which you can access on the right.

The following partial screen grab shows the HIB strategy in action. The (overlap) defocus CoC was put at 12 micron, ie double the 24mm RoT H. The POI is less than H/4, thus we take focus brackets at the POI, at twice the POI and at 4 times the POI, as well as an infinity shot at twice H.

I hope you have found this post of some value. As usual I welcome feedback of any kind.

Sunday, June 7, 2020

Hyperfocal Bracketing Simulator (HBS)

In the previous post I talked about two eClasses I have created, both accessible through the eClasses links on the right: Getting more out of Focus :-) and Getting even more out of Focus :-)

These two classes lay out the foundation of an integrated focusing methodology, for both tilted and non-tilted lenses, based on simply knowing the hyperfocal distance.

In addition, the classes show that you can calculate the hyperfocal in your head, using the Rule of Ten (RoT). No apps; no tables; just simple arithmetic, eg doubling or halving.

Each of these two classes includes a specific simulator, that allows you to explore the ideas presented in each class.

In this post I'm pleased to introduce a third simulator, specifically directed at helping you understand hyperfocal bracketing.

Access to HBS is from the link on the right: under eClasses.

The simulator has sufficient instruction built in, so I won't duplicate that here.

The simulator allows you to independently select your infinity shot and up to four hyperfocal brackets, ie at H/2, H/4, H/6, H/8 or H/3, H/5, H/7, H/9 according to whether you are using the Evens or Odds rule.

The simulator looks like this, where we see that diffraction is switched on; That we have an infinity shot at 2H and that we have two (evens) focus brackets to cover the near field, ie at H/2 and H/4.

As usual I welcome feedback on HBS, especially ideas to make it better.

Wednesday, May 20, 2020

Getting (even) more out of Focus :-)

Anyone looking back and reading this post in future years, or anyone’s post created in the first half of 2020, needs to be reminded that most of the planet was in ‘lock down’ for months, thanks to COVID-19.

Of course, in the greater scheme of things, the COVID-19 story is ‘just’ another footnote in the Earth’s history. We will prevail, and many of us hope the COVID-19 lessons will be used by those who try and govern us, to make a better world: only time will tell.

One positive that has come out of the COVID-19 times, if you forgive me saying that, is the time that has been created, albeit restricted within our homes, to reflect and reenergise ourselves, without the ‘distractions’ of our ‘normal’ lives.

For me, I have taken the opportunity to create a two-part ‘photography class’ on non-macro focusing, that I gave to my Camera Club in two webinars.

I titled the classes ‘Getting (even) more our of Focus :-)” and their purpose was to help dispel a few myths about focusing and introduce a few (science-based) ‘rules of thumb’ to help photographers with their focusing, eg the ‘the Rule of Ten (RoT)’ to calculate the hyperfocal in your head and ‘the Odds & Evens Rule’ to assist your manual focus bracketing.

The classes were recorded, but only club members can access these recordings. However, when I created the classes, I had it in my mind to provide a (free) learning resource for all, hence I made use of the Desmos environment to create two standalone, web-accessible e-classes.

Desmos is well known to school maths, science and engineering teachers. It is rich in functionality, especially when it comes to graphing.

The first class, ‘Getting more out of Focus’, includes a focus simulator that allows the ‘student’ to explore the blur field created by the lens defocus and the aperture diffraction, as well as exploring focus bracketing. It also introduces: the ‘Rule of Ten’; the odds part of hyperfocal bracketing for focus bracketing; and how to control infinity focusing. All in your head, without any apps or look up tables.

The second class, ‘Getting even more out of Focus :-)’, introduced a refinement to the first class and consolidated the RoT and infinity focusing, and used the evens part of the Odss & Evens Rule. It also provides a Tilt & Shift simulator to allow the student to explore and practice using the ultimate focus control lens, the Tilt/Shift lens. Finally, it demonstrated how to post process focus brackets using various tools (but this is only accessible to my photography club’s members).

Although the class mentions Magic Lantern, and discusses how Lua scripts can help in focusing, the two classes are not Canon specific.

The classes are free to access and can be found via the following two links:

Class 1:

Class 2:

To access the classes simply use the links above and enter your name (real or not).

I hope you get some value out of the above. Creating these classes greatly helped me get through the COVID-19 crisis. As usual I welcome feedback: either here or via the feedback pages in the classes.