Sunday, March 3, 2019

Bad weather = self development

Looks like a miserable day weather-wise, so I decided to refine my workflow associated with my visible band & IR band digital (EoSM) backs on my 645 Vizelex RhinoCam system.

The RhinoCam allows me, via my Mamiya-Sekor 45mm lens, to create seamlessly flat large 645 image or a pano, ie no nodal points to worry about ;-)

In 645 mode, the EoSM is used in portrait mode, as below, and in pano mode it is used in landscape mode.

I've recently been exploring using an ML-based work flow, for the exposure, with an extended DoF technique, through using focus bracketing with the sensor bracketing.

Following composition setting, I first use ML’s ETTR to help me select a suitable base exposure for the highlights; and decide if I need to exposure bracket as well.

I then set focus using the 'Rule of 10', which says that if I use an aperture of F/10 and focus at 4.5m (45mm/10), I’ll be at the hyperfocal with a CoC of 45 microns, ie the FL in microns. Whereas a CoC of, say, 30 micron, is a good Full Frame starting point, 45 microns is the 645 equivalent.

From there I may adjust things as required. For example, I could add some background focus insurance and set the focus to, say, 6m, ie rather than the theoretical 4.5m.

Note that, because we are using a 645 format, I can also push the aperture more than we would with a 35mm format, ie extending the DoF. Thus I could go up to F/20 with my visible band EoSM back, but ‘only’ F/18 with my IR EoSM back; before diffraction started to dominate.

As the Vizelex RhinoCam system needs to take 8 images (two rows of 4 sensor brackets) with the EOSM in portrait mode, this gives me the opportunity to adopt two focus strategies. One for the top row and one for the bottom row.

That is I can focus bracket as well as sensor bracket in the same image. And, as mentioned above, if required, I could also exposure bracket at each sensor bracket, eg using a Zero-Noise bracket at, say, 4Ev for the shadows; that is if a single exposure wont hack it.

I then focus at 6m, in this case, and take the top four sensor bracket images (with exposure brackets if required).

Having then repositioned the RhinoCam system for the bottom row of sensor brackets, I then refocus the lens at the H/3 point, ie to extend the near DoF in the foreground from H/2 to H/4. For example, I refocus the lens to around 2m, ie 6/3, which will extend the near DoF from the 3m in the top row, ie 6/2, to 1m in the bottom row, ie (6/3)/2.

After ingesting into Lightroom, I simply use the LR Merge capability.

As an example (indoor) test shot, I used my visible band EoSM and ETTRed for the highlights, at ISO100 and at F/16. Giving a base exposure of 1.3s. I set the ML Auto bracketing to 2 images and +4Ev to create a single ‘zero-noise’ bracket for the shadows, ie at shutter of 20s. I focused the top row at 6m and the bottom row at 2m.

After ingesting into LR I tried to use the combined HDR-Pano merge in LR, but this failed with an ‘error’ of not enough matching images. I therefore resulted to doing a two-pass merge process in LR: HDR the two exposure brackets first, with auto stacking switched on; then do the pano merge in LR.

Finally, I tweaked the image for ‘a look’.

The resultant test image is a 283MB, 9367x8865 TIFF image, that, in the rendition below, is JPEGed down to 4Mb!

I hope some have found the above of interest and as usual I welcome any feedback.

Thursday, February 21, 2019

More Focusing & Stacking with CHDK

I've now updated the CHDK Landscape Focus Bracketing script and thought it worthwhile reminding readers what this script can do.

Being a CHDK Lua script, it runs on Canon Powershots. I've tested it on my S95, my G7X and my G1X.

In this post I show an example of what the script can do on a G7X, which has a minimum focus of 20cm.

The script can now work in a near full auto mode, using the Mac2Inf focus bracketing option. If this mode is selected, the script will automatically position the lens at the camera's minimum focus and, according to the infinity blur that you selected, will focus bracket from the minimum focus to the blur-defined infinity. Several bracket to bracket overlap strategies are covered, eg none, or at CoC/2, or at CoC/3 or at the diffraction corrected defocus CoC.

At each focus position the script can take various exposures, eg:
  • two additional time based exposures at +/- or +/++ or -/-- (at 1, 2 or 3Ev)
  • one additional ISO bracket at either ISO 800 or ISO 1600, set according to the when your camera's ISO invariance zone kicks in
  • one zero-noise time bracket at 4Ev
In the tabletop example below, I positioned the flower a couple of inches away from the camera and used the Mac2Inf option, together with the zero-noise exposure bracket option.

This resulted in 17 focus positions, with two exposures at each focus station, ie 34 images.

The images were processed in Lightroom as HDRs and then exported, via a round trip, to Helicon Focus. Base exposure, for the highlights, was ISO 125, F/5.6 at 1/60s. The zero-noise exposure was at 1/4s.

Here is the resultant test image, albeit only lightly 'touched up' in Helicon Focus, ie I should have spent a few more minutes touching up around the petals. Nevertheless, I hope this example gives readers a flavour of the script's power.

As usual I welcome any feedback.

Wednesday, January 16, 2019

Update of Landscape Bracketing script

Just a short post to say I've updated the CHDK Lua script, that runs on Canon Powershot cameras.

The CHDK post about the script may be read here:

You may also download the script from:

Thursday, January 3, 2019

Landscape Focus Bracket Script for the G7X

In this post I'll be talking about my latest 'toy', the Canon Powershot G7X and in particular focus stacking with it.

As we know, macro focus stacking is rather 'easy' to undertake, albeit rather tedious. This is because the near and far depths if field (DoFs), ether side of the point of focus, are virtually symmetrical but very small. 

As soon, however, as we move away from the macro end, the near and far DoFs become progressively non-symmetric, until we reach the hyperfocal point (H), where the near DoF is, of course, H/2 and the far is at 'infinity'. Also the defocus blur field changes through the scene; being zero microns at the point of focus and the 'circle of confusion' set blur at the near and far DoFs.

However, it's relatively simple to estimate (sic) the bracketing that is required. That is, if I'm focused at Sn, where do I focus next (Sn+1) to ensure that my current far DoF is the same as my next near DoF, as illustrated here:

If we didn't explicitly calculate the correct Sn+1 focus position, and, say, only assume a fixed refocus delta, as we do in macro photography, we would end up with 'focus gaps', like this:

As it is near impossible to guarantee that the refocused position is a perfect match, we usually use an overlap 'insurance' to cover ourselves, like this:

With macro focus bracketing, which is usually indoors, we can either make use of rails or even try and move the lens in-camera. But for landscape photography, rails will not really work; plus we also we need to calculate the next focus position.

To date I've tried to solve the in-camera solution by Lua scripting on my EOS 5D3, using Magic Lantern. But I've now given up with that approach, as ML can not (yet) explicitly control the lens, ie drive it to an explicit position. Instead, on my EOS cameras I now use the DoF Bar to give me the required feedback, so I may manually adjust focus to the correct position.

With my 'new' G7X I'm pleased to report that everything just got brighter, as the CHDK environment does allow me to explicitly drive the lens; albeit with a little, but acceptable,  'jitter'.

The script below (a Lua CHDK script I've written that I call Landscape Bracketing) provides three user variables. The first is a simple delay to allow you to trigger the script on the tripod: the default is 3 seconds. The second input is whether you are requesting the script to create a start and end (dark) bookend frame, which helps identify the bracket set in post: the default is yes. The last input is the overlap logic that the script uses: the default is none, ie each bracket will link to the next using the CHDK CoC value. The other two options are 'some' and 'more'. Some will use a overap blur of CoC/1.25 and 'more' will use one of CoC/1.5.

In general the script captures the bracket set from near to just short of H. It then takes two more images: one at H and one at 2H.

As an example, here is a 7 bracket set (screen capture from Lightroom) that the script captured of my test scene:

Here is the near (1st image) showing the narrow DoF at that point:

Here is the last (7th Image), taken at 2*H, which insures our infinity focus quality

Here is the focus stacked image after a round trip to Helicon Focus, showing there are no focus gaps:

The script may be downloaded from the link on the right.

I must say, I'm impressed with the power of the CHDK Lua environment, which provides more functionality than Magic Lantern's Lua; but to be fair we are comparing apples and pears, ie a full frame DSLR to a point and shoot camera. Nevertheless, the G7X represents a great little travel companion for my pocket.

Sunday, December 30, 2018

Some thoughts on focus bracketing with the G7X

Having had a few days to 'play around' with my 'new' G7X, I thought I would start talking about the power that's built into this little marvel, especially when running CHDK.

The basic G7X has limited exposure and focus bracketing and an inbuilt ND filter capability. So, on its own, it's pretty powerful. But add on CHDK and we can take it to to another level.

Canon bracketing is restricted to three brackets: one at the set exposure or focus and one either side of these points. Although you can set the Ev offset for exposure bracketing, with focus bracketing there is no user information to indicate what the focus deltas mean.

Using CHDK, in 'enhanced photo operations', we have access to a great feature called 'Bracketing in Continuous Mode'; which results in CHDK adjusting exposure or focus between the Canon controlled multiple shooting that is accessible via the custom timer. 

Thus we can control up to 10 brackets with CHDK and whether the bracketing sequence is +,++,++... or -,--, ---... or i,+,--,++....

As we know, focus bracketing for landscapes is not the same as that for macro shooting. In macro shooting the depth of field ether side of the point of focus is essential the same and small. In landscape focus bracketing this is not the case. For example, if we take an image at the hyperfocal, H, then if we wish to extend the focus quality either side, we would take a bracket at H/3 and, say, at 2H. See previous posts that illustrate the non-symmeteric nature of landscape focus bracketing, eg:

The above chart hints at a way of focus bracketing without having to write a script. The objective being to achieve the 'best' focus from near to infinity. 

As we know, focusing at the hyperfocal is far from optimal, as, by definition, the hyperfocal is where we just about achieve acceptable focus quality at infinity. Namely, by defining a blur criterion, also called the circle of confusion, we can work out the focus distance that gives this blur at infinity, ie this is our hyperfocal.

The CHDK inbult depth of field and hyperfocal calculations appear to be based on an acceptable CoC that is far from optimal, ie about 30 microns x the G7X crop of 2.7: or about 11 microns. 

We also know that focusing beyond H, although it will give us better focus quality at infinity, will result in loss of near depth of field. In the limit, if we focus at infinity, our near depth of field will be at H; and the blur at H will be the CoC, whereas the blur at infinity will be zero, as it always is at the point of focus.

So if 11 microns is the 'just good enough' value for the G7X, what is the best we can do? Well the G7X pixel pitch is about 2.4microns and for a line pair we need two lines, so the sensible, smallest CoC would be about 5 microns, ie 2 x sensor pitch.

All this ignores diffraction blur, which on the G7X means we shouldn't really go beyond F/5.6. So focus backeting around F/4 to F/5.6 is a sweet spot.

Bringing all this together means that, after experimentation, I ended up with the following approach to achieving landscape focus bracketing on the G7X, without resorting to scripting.

Using the chart above we can see that a four bracket set up, around, H, will gives a quick and simple way of enhancing focus quality. The usual caveat being that our subject shouldn't be moving, well at least not wildly.

I selected F/4 as my working aperture, ie for diffraction reasons, and, using the inbuilt CHDK depth of field on-screen feedback, at the widest focal length, the hyperfocal is indicated to be 1.87m. Giving a near DoF of about 0.9, ie H/2.

But, as we know, the blur at the near and far limits will be about 11 microns, ie only just OK. We also know we can easily half that blur at infinity,bringing it down to about 5 microns by simply focusing at 2H.

For the near field we need to do better than H/2, which is what we get if we focus at H alone. The next bracket down from focusing at H is H/3, which extends the near DoF to H/4.

So now we have the two extremes of our bracket set: one at H/3 and the other at 2H. The difference between these two is 5H/3, which we can divide by 3 to give an estimate of the inter bracket distance, ie 5H/9, just under 2/3 of H. Resulting in the following four focus bracket schema:

So what's the bottom line?

For landscape focus bracketing I recommend focusing on the nearest object of interest, assuming it is less than H, then set the camera to manual focus mode and look at the CHDK DoF info to get the value for H (make sure you do a half shutter press to ensue CHDK refreshes things), take about 2/3 of H and use this as the subject distance in the CHDK focus bracketing variable.

Then in the Canon side set up for 4 continuous images in the custom self timer.

Here are the four test images I just took in our back garden:

And here is the focus stacked image after a round trip from LR to Helicon Focus, plus a little LR tweaking:
So there you have it, landscape focus bracketing informed by CHDK and taken with the help of CHDK, but without any scripting.

The Secret of getting Cheaper and Better Cameras

As readers of my blog know, I love 'hacking' my cameras. For my EOS family, my visible band EOSM, my IR band EOSM, my 'medium format' EOSM and my 5D3, Magic Lantern is, of course, an essential tool. ML gives me RAW control over exposure, enhanced DR via Dual-ISO, automatic bracketing and scripting, eg allowing me to create the DoFBar.

My EOSMs, yes I have three, got me thinking about value when it comes to hardware. These three cameras were all purchased second hand. In fact I got all three for the cost of an original EOSM.

Like many, I think today we are overly encouraged by manufactures of our TVs, phones or cameras, to 'upgrade' to the latest and best technology. But, in doing this I feel we may be missing a 'value' trick: that is, rather than upgrade, why not consider 'downgrading'.

The reason the 'downgrade' option works is that previous versions of our cameras are still very good. So rather than rush out to get the latest, think about looking backwards: which is what I did over Christmas.

At the moment my pocket camera is a Canon Powershot S95, hacked, of course, with CHDK. It's OK, but it has a very small (1/1.7") sensor, as can be seen in this chart:

This got me thinking. I looked on the CHDK site to see what was the largest Powershot camera that could run CHDK. Which lead me to the G7X. You can pick up the latest G7X, the Mk 2 for about GBP430 in the UK, but it doesn't run CHDK (yet). But the Mk 1, with the same (1" Sony) sensor, goes for half of that on eBay.

BTW the term 1" sensor is misleading, as this does not refer to the sensor's physical size. The term being a legacy from the old vacuum tube days; but that's another story.

So my Christmas present to myself was a secondhand camera: a Powershot G7X.

The camera has the advantage of a tilting screen, which is great for low level shots. As the Canon website says: "The PowerShot G7 X is a premium high-performance camera that puts exciting and impressive capabilities in a sophisticated, compact package. It starts with the sensor: a large and light-grabbing 1.0-inch, 20.2 Megapixel High-Sensitivity CMOS sensor powered by Canon's latest generation DIGIC 6 Image Processor for beautifully rendered low-light photography up to ISO 12800. The IS lens is a f/1.8 (W)-f/2.8 (T) that puts more in your frame while staying bright to the maximum 4.2x Optical Zoom (24mm-100mm), with a 9-blade circular aperture diaphragm for artistic background blur, and a minimum focus range of just 5cm for precise macro shooting. Wi-Fi® and NFC-enabled, the PowerShot G7 X is selfie-ready with a high-resolution multi-angle capacitive 3.0-inch touch panel LCD. Shooting is a joy with High-Speed AF (0.14 sec.), 31 AF points, full-resolution continuous shooting up to 6.5 fps and 1080p/60p HD video." 

As soon as I got the G7X I loaded CHDK, after confirming I had the rev d canon firmware. I then tested my likely top feature in CHDK, namely bracketing, which worked perfectly.

I'll write about the G7X and CHDK in future posts: for now I'll leave the reader reflecting on my 'downsizing' thoughts. That is getting (great) value for less, by looking backwards!


Sunday, December 9, 2018

DoF Bar: Simple Focus Bracketing

In this post we will look at how DoF Bar can help you get perfect in-camera focus bracket sets. In the next post we will look at more advanced focus bracketing, but for now we will keep it simple. The DoF Bar settings for the simplest bracketing looks like this:

Here we see that the minimum focus has been set to the minimum DoF distance that we can achieve with the 24mm lens we are using at F/8, ie 390mm. We also have selected ‘Brackets to H’ in Pro Mode, as this will tell how many focus brackets we will need to take.

After composing the scene, in this case a really exciting image of my dinning table, we position the lens to as far as it will go to the macro end. Note that we can focus bracket in both directions, but in this post we will show the process near to far. The LV screen now looks like this:

DoF Bar is telling us that we will need at least 4 brackets to cover from where we are to the hyperfocal. As this will ‘only’ get of far DoF to the hyperfocal, we will usually take an additional image in the infinity focusing zone, ie H-4H, using the DoF Bar infinity blur feedback to inform our choice.

Note: the bracket to H information dynamically updates as you change focus.

We down take our first focus bracket, covering a DoF of 39-52cm, as shown below. DoF Bar also tells us that the lens defocus blur, at the DoFs, is 28microns.

As we haven’t moved to the next focus point yet, the top, showing the last image captured, mirrors the current focus conditions.

Let’s now focus away from the macro end and use the DoF Bar feedback to tell us when to stop. Remember we are looking to get the current near DoF as close as we can to the last image captured far DoF. To help us, DoF Bar flags up when we have over focused, ie the current near DoF would turn blue.

Here we see we have achieved the best conditions for the next bracket, with the current near DoF just short of the last far DoF. The current DoF now covers 52-80cm.

We now repeat the above until we are at the third focus bracket:

Here we see the current DoF covers 77cm to 1.71m. The final bracket, number 4, being this one:

Here we see that the current near DoF is 1.58m, ie less than the last far DoF of 1.71m, and that because we are focusing past the hyperfocal, our current far DoF is providing us with blur information, namely: we have an infinity defocus blur of 19microns, a diffraction blur of 10microns, giving a total blur of 21microns.

As we are seeking a near to infinity tack-sharp image, it would be prudent to take a final image to maximise the far field’s focus. DoF Bar helping getting us to this situation:

Here we see we have reduced the total blur to 14microns and the defocus and diffraction blurs are nearly the same.

We now have five focus brackets that need post processing. In this case, I also had Dual-ISO switched on, so the first step, after ingesting into Lightroom, was to process the Dual-ISOs arriving at these five images, clearly showing that, at F/8, we could not cover the full depth of field:

Macro End: 1st Image

2nd Image

3rd Image

4th Image

Infinity Focused Image

These images now need to be focused stacked, using your preferred approach. In this case I did a round trip to Helicon Focus, arriving at this ‘final’ image, ie I haven’t really bothered with any post processing beyond the basics.

In this post we have shown how DoF Bar can give you perfect focus brackets, near to far. A tack sharp image from the closest focus you can achieve on a 24mm at F/8, ie about 39cm, to a far infinity focus generating a total blur of 14microns, ie double the quality of an image taken at the hyperfocal.

In future posts I’ll provide further insights into DoF Bar.