Tuesday, April 25, 2017

Getting the best out of Hyperfocal focusing

As I am about to release a new version of my Landscape Auto Bracketing Script (LABS), I thought I would write a piece on why hyperfocal focusing is not (sic) the best focusing strategy for landscape photography.

As most readers will know what the hyperfocal distance (HFD) is, I will only provide a simple reminder here.

  • A (normal, ie non-tilt) lens is only in focus at one distance, ie the point of focus (PoF), really a plane of focus;
  • Either side of the PoF, the lens becomes progressively more out of focus;
  • The eye-brain system is only able to assess things as ‘out-of-focus’ when they become ‘visable’, ie below a certain level of ‘out of focusness’, things look in-focus, even when they are not at the actual point of focus;
  • For non-macro lenses, the zone of (acceptable) focus (ie the depth of field) in front of the PoF is (much) less than the zone of focus (DoF) behind. More correctly, the DoF is the zone of ‘acceptable out of focusness’;
  • There is a PoF where the far DoF is ‘just’ at infinity: this is termed the hyperfocal distance (HFD);
  • Photographically, ie from a camera-lens perspective, infinity can be quite near;
  • Most lenses are not symmetrical, ie they have pupillary magnification (the ratio of the diameter of the exit pupil to the diameter of the entrance pupil), but to illustrate things, and practically for this post, it is convenient to assume they are symmetrical, ie we ignore pupillary magnification;
  • Conventionally, the amount of acceptable out of focusness (blur) is measured as the Circle of Confusion, which is a sensor plane measurement. Many web sources will quote a CoC figure for a full frame camera of 0.029 or 0.030mm, however, this CoC is about the ‘worst’ you should consider living with, ie acceptable for on-screen presentation only, ie not for printed art viewed up close!
  • The CoC will vary with camera format, and in general the viewing distance and image size should inform the CoC (see this post - http://photography.grayheron.net/2015/06/could-this-be-optimum-focus-stacking.html);
  • A rule of thumb, is that the CoC shouldn’t be less that two sensor pixel widths on the camera sensor, eg a Canon 5D3 has a pixel pitch of about 6.3 microns, giving a minimum CoC of, say, 13 microns (0.013mm);
  • To make things more complicated, diffraction blur needs to be added to sensor blur, to create a ‘total’ blur. This is normally done in quadrature, ie total_blur^2 = senor_blur^2 + diffraction_blur^2

Graphically the above looks like this first illustration, showing a 24mm lens at F/8, with a total blur of around 0.03mm (blur =1), focused at the HFD, with and without the effect of diffraction accounted for. 

Anything below a blur of 1 meets the total CoC criterion, ie sensor blur + diffraction (if being used). The chart also shows the classical focus characteristics, ie not much focus in the near field and the far field approaching the unacceptable limit way before ‘infinity’, ie a strong asymptote:

We can also clearly see the effect of diffraction and can now see, that the HFD represents a compromise across the entire (landscape) depth of field, ie from the nearest object we wish to see in focus, to the furthest. But, and this is the key problem associated with focusing at (sic) the HFD, way before infinity the image is only ‘just’ within the acceptable (out of focus) criterion; and we should worry about this, as the blur (eg CoC) has a direct relationship to the visible quality of the image, especially a printed image, as halving the blur, ie going from 1 to 0.5, doubles the lp/mm.

This leads to an obvious question for landscape photographers, especially those printing their work: can we do better than the HFD, ie over the entire scene?

The quick answer is: yes!

Alternative #1: Focus at Infinity

Clearly if we focus at infinity, then, by definition things will be the most in focus at that point. But how much depth of field will we lose in the near field? The answer is: not much. But we need to be careful, as modern lenses will focus 'beyond infinity'.

The depth of field either side of the PoF, if we focus at the HFD, is simply HFD/2 to the ‘left’ of the HFD, ie the near field, and, infinity to the right of the HFD, ie the far field. Thus, if the HFD was, say, at 1m, then the DoF will be HFD/2 to infinity, ie 0.5m to infinity.

If we now focus at infinity, clearly the far field DoF, ie to the right of the PoF doesn’t mean anything, ie we are focused at (photographic) infinity, ie 100m in this case. The near field DoF, ie to the left of the PoF will obviously move toward the PoF, ie infinity in this case, but by how much?

The answer is that it will move to the HFD. That is you can never get less near field DoF, ie the acceptable focus to the left of the PoF, than the HFD. In the example above, the ‘loss’ in DoF is ‘only’ 0.5m, ie the near field DoF has moved from being at 0.5m (HFD/2) to 1m (the HFD). Graphically, using our 24mm example, things look like this, where I have assumed I’m shooting with a typical ‘lofi’ total CoC (0.03mm) with diffraction accounted for, at F/8:

The above also hints at how we can do better than the HFD, as, clearly, the blur in the far field, ie beyond about 5m in the above example, is worst for the HFD focus than focusing at infinity.

An alternative interpretation of focusing at infinity is to note (thanks to Harold M. Merklinger) that one doesn’t need to worry about HFDs etc, ie by focusing at infinity and stopping down the lens aperture to F/x, the smallest resolvable feature will be at FL/x. Thus, with a 10mm lens set at F/10 and focused at infinity, the smallest (in focus) resolvable feature will be 1mm. With a 200mm lens at F/10, it will be 20mm.

Regarding infinity, this following graph, for our 24mm and F/8 illustration, shows the impact of focusing at 10m vs 100m:

Alternative #2: Focus slightly beyond the HFD

As was hinted above, the worst place to focus is at the HFD; as, from a landscape photographers perspective, the main scene will only ‘just’ be in focus.

What about just (sic) focusing beyond the HFD, ie rather than at infinity; could this help. Yes and dramatically!

As a working assumption, let’s assume we focus at twice the HFD. As the next graph shows, we lose a little in the near field DoF, but look what we gain the far field DoF. Bluntly, for the majority of the scene we will have a sharper (less out of focus image). The loss in the near field is FL dependent, but very small for a ‘typical’ wide lens. The following graph illustrates the difference between a 24mm lens focused at the HFD and at about 3xHFD, ie 8m.

I think most will agree: a rather dramatic and surprising result, ie similar to focusing at 100m (infinity).

This also leads to a key finding, that we don’t need to use high apertures, eg F/16, to get large depths of field. This is important for landscape photography as we wish to not only maximise the depth of field, but also the image quality across the sensor. Without going into detail, a good rule of thumb is that the ‘best quality’ for a lens, across the full FoV, will be found at about 2 stops down from the the widest aperture. 

For illustration in this post, lets stay at F/8 and plot our 24mm at an HFD F/16 (with diffraction) and at 3 x HFD at F/8 (with diffraction):

Yes there is some loss in of DoF in the near field, but look at the focus quality in the far field. Remember half the blur is equivalent to doubling the lp/mm quality.

To illustrate the diffraction loss, let's look at two cases using our illustrative 24mm lens, We will set one to F/8 and one to F/16, and focus both at 8m. What is clear to see, is that at F/16 we get slightly more in the foreground in focus, but only about 0.5m. But look at the loss in the background, ie from about 2.5m and beyond. All because we stopped down and diffraction kicked in. Remember, the closer we are to zero in these plots, the less blur, or out of focusness, we will see; and closer you are to 1 the greater the chance you will see 'softness' in your image, especially if you print your image for critical appraisal. Remember from an early posts (see link above) that blur has a linear relationship with the line pairs quality of your printed image, and a CoC of around 0.03 on a full frame is not that exacting for print. In all the charts in this post, where I've assumed a total blur of 0.03, achieving a blur of 0.5 at infinity means a doubling of the lp/mm quality when printing.

Alternative #3: HFD Focus Bracketing

Because this post is directed at landscape photographers, I’m assuming a tripod is in play. Based on this, we could do even better than Alternative approach 2, ie we could focus bracket.

As we have seen above, once you focus a little past the HFD, say between 2xHFD to 3xHFD, there is little point in focusing beyond that, ie at infinity. However, even if you focus at infinity, your DoF will be acceptable from the HFD to infinity.

But what if you wanted to get more of the near field in focus. Well this is where landscape focus stacking comes into play. Unlike macro focus stacking, where the near and far DoFs are symmetrical (and very small) and you can use macro rails, the near and far DoFs in landscape focus stacking are non-symmetrical.

Attempting to overlap the acceptable focus zones, as one refocuses, is difficult, unless you have technology to help you, eg my Magic Lantern Auto Landscape Focusing Script, that move the lens and ensure the correct focus overlaps.

But what if you don’t have ML and Lua scripting in your camera? Well all is not lost as it is very easy to undertake a simple two focus bracket set around the HFD, ie by using your lens focus markings. That is take one image for the near field at HFD/2 and one for the far field at 2 to 3 x HFD. This graph (24mm at F/8) shows such a focus bracket set and what is gained in the near field. The HFD is at about 2.7m, so I focused at 1.4 and at 8m:

It would be a simple matter to focus stack these two images in, say, Helicon Focus or even Photoshop.

Bottom line: Although the common wisdom is to focus at the HFD and use small apertures, it is clear that this is far from an optimum strategy for landscape photographers on a tripod. It is far better, assuming you don’t need to get things that are very, very close to the lens in focus, to focus at 2-3 times the HFD, or even at infinity; and don't stop the aperture down too much, ie use a sweeter spot at, say, two stops down from the widest aperture. The ‘worse case’ is you will have everything in focus from the HFD to infinity and the blur over the main scene will be less than if you focused at the 'exact' HFD. That is, by adopting a 2-3xHFD or infinity focus strategy, your main scene will be as sharp as if you had chosen a much more demanding CoC.

Finally, for those wishing to explore HFD-based and other focusing strategies, I can recommend the cBlur App: http://www.cblur.org/en/. Although this is a German web site, there is sufficient English on the site and in the App to be usable for the non-Germans amongst us. Many thanks to Heiko Kinzel for this very useful tool.

Thursday, April 20, 2017

My IR Post Processing Workflow

As many know, I’m lucky enough to have a Canon that can access Magic Lantern. This means I can maximise the quality of the captured photons through tools such as RAW Spotmeters and RAW-based ETTR. I also have diffraction corrected focus feedback in my Live View and thus, ‘all’ I need to worry about is composition.

This last week I’ve been re-acquainting myself with Infra Red photography, using my trusty IR-converted 50D.

Today’s post is all about how to post process IR captures in B&W.

First, as anyone who has shot IR knows, it’s difficult to focus and set exposure. From my experience the only sensible way to capture an IR image is to use the camera’s LV. If you don’t have a DoF app that allows you to explore IR frequency focusing, such as TrueDoF-Pro (http://www.georgedouvos.com/douvos/Intro_to_TrueDoF-Pro.html), then simply select a focus point beyond the visible band HFD. 

It's almost always best practice to 'never' focus at (sic) the HFD, as this guarantees only acceptable focus at infinity. For example, a non-App-based approach to focusing with a wide (sic) lens, is to focus on infinity and set the aperture for resolving the smallest near-field detail. For example, with my 10mm lens , on the 50D, if I set my aperture at, say, F/10, I would be able to resolve details as small as 1mm, ie FL/N. But don't push things much beyond, say, F/10 on a crop sensor (F/16 full frame), as that diffraction will get you!

As for IR-based exposure, I always seek out a Magic Lantern ETTR solution, as this maximizes the tonal data and the dynamic range. Also, as you are shooting IR, and most likely shooting in bright sun, it is very unlikely you will need to bracket. 

Here is the RAW capture and what the LR histogram looks like, showing the ETTR bias:

The first job in LR is to get rid of the red cast and get the best out of the RAW data. The way to do that is to use a custom Camera Calibration Profile. These are easy to create using the Adobe DNG Profile Editor (free from Adobe). 

To set up a custom IR profile simply save your RAW file as a DNG (sic) and open this file up in ADPE (you only need to do this once). 

In ADPE (having closed LR) go to the Tone Curve and rather than the Base setting, choose Linear: this will pull the maximum data out of the highlights. For a non-IR image stop here and save your profile for use in ACR, PS or LR. For IR we need to make one more change, namely go to the Color Matrices tab and adjust the Temperature and Tint, usually move them over to the left. This allows addition colour temperature adjustments in Lightroom, ie beyond which you can do without this tweak. Save the profile and re-open LR, where you will see the new (IR) custom profile.

Using the above custom profile, the above image now looks like this:

Because we have used a linear, rather than gamma-based, curve in the profile, the image is very flat, and thus can handle (and needs) a lot of tonal enhancement: which works well for B&W processing.

Next, after switching to B&W processing in the LR Develop module, I would typically (and did with this image) go to the Effects tab in LR's Develop Module and move the Dehaze slider to 100%.

I would then play around with the other develop sliders, eg contrast and clarity, as well as the zonal exposure adjustments, until I had the look I was going for. In this case, I ended up with this image of the church, taken in IR at a FL of 10mm, F/7.1, ISO100 and at 1/50s.

Tuesday, April 18, 2017

LAB Channel Swap

As many are aware, to give an IR captured image a more realistic look, assuming you are processing for colour, it is sensible to get the sky looking 'right', ie has some blue in it.

This can be achieved in RGB by simply carrying out a RED/BLUE Channel swap. What some may not know is that you can also use LAB mode to achieve a similar effect.

LAB space is also the better one to be in if you are trying to 'fine tune' a colour IR image, eg using the curves tool.

As an example, take this test image I just captured in our garden at 10mm, F/7.1, ISO100 and 1/125s. The shutter was set using Magic Lantern ETTR.

The RAW capture, as usual, looks horrible:

But after a LAB channel swap and a little bit of PS/LR post processing, I end up with this:

For those that are interested, although the image here is a compressed 8-bit JPEG, the detail captured in the IR, eg in the bushes, is impressive.

False Colour IR: the Marmite view

OK, before getting to the photography, let's help out the non-British readers with one of the most wonderful spreads you can get: Marmite!

For me, Marmite is best served, thinly spread on warm toast. Marmite is a dark brown-coloured savory spread made from the yeast that is a by-product of the brewing industry. It has a very strong, slightly salty flavor. It is definitely a love-it-or-hate-it type of food. Hence the 'Marmite view' reference above.

For the 100th anniversary of Marmite in 2002, thirty-three London taxis were painted to feature the slogan, '100 years of HATE' on one side and '100 years of LOVE' on the other.

Back to photography. 

Yesterday I posted an IR image on my Facebook page: this post is to follow that posting up with a little more technical detail.

As a reminder, I shoot with an IR converted 50D. The IR conversion replaces the standard IR filter in the camera, which usually blocks above, say, 720nm, with a filter that blocks, in may case (you can choose different filters) below  720nm.

The downside is Canon's auto sensor cleaning technology is removed, thus auto cleaning at shutdown etc needs to be switched off.

The upside to the conversion is that I can take IR (reflected sunlight) images at hand holding shutter speeds; and, of course, IR photography fills that gap between the golden hours where most photographers like being active. Some of the best conditions for IR photography are midday or in bright sunshine.

As an example take this 10mm (FL), handheld IR capture I took in Iceland, on a very overcast day, at ISO400, F/7.1 and at 1/30s.

...and here is Rawdigger's view of the four Bayer channels in the .cr2 RAW:

Usually I would post process the image as a Black & White, but, on this occasion, I decided to try to keep the image in RGB colour space.

The first processing step is to remove the colour cast, which I did in LR using a custom Camera Calibration Profile I created; giving me this new base image:

The next step is to undertake a channel swap in Photoshop followed by more processing in PS and LR to bring out the detail in the sky, which looking at the base RAW you wouldn't appreciate. This 'hidden' detail is another reason to shoot IR; as even on a 'flat' day, there is a lot of structure in the sky.

The final image looks like this: where I've added some grain, to 'cover' the ISO 400 'noise'. I also went for a 'pano-like' presentation at an aspect ratio of 21x9, ie (4x3)^3.

Bottom line: IR photography provides an alternative to 'normal colour' photography and is fun as well: especially as it allows you to explore a different colour palette to your normal one.