Jump to content
 
  • entries
    34
  • comments
    48
  • views
    11,189

Improving Photos with "Focus Stacking"


Harlequin

1,209 views

To take good photos of model railways it's really important to control the depth of field or focal depth of the image. This is best demonstrated by @KNP's wonderful photographs of his masterpiece, Little Muddle.

This blog entry describes my first experiments in improving depth of field in my photos.

 

Why Depth of Field matters

Definition: The Depth of field is the distance between the nearest and furthest objects that are acceptably in focus.

 

I'm not a photography expert and I don't claim to understand all the technicalities of depth of field but in a nutshell, the closer the camera is to the subject, the smaller the depth of field. Or to put it another way, when the camera is close to the scene only details at a very specific distance from the camera will be in focus and the rest of the image will be blurry. (This is to do with the angles of light rays entering the camera.)

 

Real world photos have a much deeper range of good focus because of the greater distance between the camera and the subject. (Technically, because of the smaller angles at which the light rays enter the camera.)

 

So small depth of field is a problem when photographing models for two reasons:

  1. When you focus on a particular item of interest it means that many other details are out of focus. E.g. you focus on the smokebox of a loco and then the cab, which is only a few centimetres further back, is blurred.
  2. The lack of focus is not just annoying in it's own right but it's a dead give-away that you photographed a model, no matter how realistic your detailing was!


Focus Stacking

So we want a way to increase the depth of field when photographing our models and this is where technology comes to the rescue in the form of "Focus stacking" or "Focus merging".

 

A focus stacking algorithm analyses several photos taken at different focal lengths and mixes the best focused parts, the sharpest parts, to create one good image.

 

How to do focus stacking

To apply focus stacking you need to:

  1. Capture your images digitally. Many compact digital cameras and Smartphones have very good lenses and high resolution sensors and are perfect for this task.
  2. Capture a number of images without the camera moving. To ensure that the camera doesn't move while capturing the images you need you ideally need some sort of tripod. A mini tripod with a swivel mount and flexible legs is ideal.
  3. Capture images at a range of focal distances. You could attempt to refocus manually between each shot but it's much easier and more reliable to let the software on the camera do this for you. Some cameras have that feature built-in and there are apps for Smartphones to do it.
  4. Collect the images together and process them in a suitable software package. Many high-end photo processing software packages have the ability to perform focus stacking and there are some free apps and utilities.

 

My first experiment

I used my Android SmartPhone, a OnePlus 3, mounted in a swivel head on a small tripod.

1965868763_IMG_0063r.jpg.251298de61e556389fbe651bde05dded.jpg

 

To capture the images automatically I installed a free app called, OpenCamera, which gives much more control than the standard Android Camera app. Here it is in operation:

 

The two large sliders on screen set the front and back focus points for the stack. The smaller third slider is the zoom factor. The software is set to take 16 images in this example but it can take up to 200!

 

[Edit: OpenCamera requires a phone and a version of Android that allows apps to control the camera focus.]

 

To process the images I first tried an open source desktop application called CombineZP but I found it to be difficult to use and not very reliable. In the end I settled on Affinity Photo, a highly accomplished and very affordable desktop photo editing package which has a good focus stacking feature. (This was a hard thing for me to do because the Affinity software is "the competition" in my professional life!)

 

Here are two of the raw images, numbers 2 and 12 from the stack of 16:

867596468_IMG_20190323_135843_2small.jpg.b8324da6f065c588c7adf57a1c5f73d2.jpg1562481456_IMG_20190323_135843_12small.jpg.b4403a48f2f2f3fe61423c5a3ed044ca.jpg

 

You can see that image number 2 is focused near the smokebox door of the loco but the background is out of focus. And image number 12 shows the background train in focus but the loco is blurred.

 

Then the full stack of 16 photos was given to Affinity Photo and it produced this result (after cropping):

896272285_48xxtest2.jpg.0bf11aa88370b49b7fb81e00160d9612.jpg

 

You can see that the process works and it was quite easy once I had gathered together all the necessary tools. I will do some more experiments and try some creative ideas.

 

Edited by Harlequin
Adding lost images

  • Like 4
  • Informative/Useful 14

7 Comments


Recommended Comments

  • RMweb Gold

Thanks for link to the app :) 

 

I generally use a custom script on my Canon that shoots from the current focus up to the hyperfocal length of the lens then stack in Photoshop CS6 but it will be handy to use the phone if I've not got my full kit with me :)

  • Informative/Useful 2
Link to comment
  • RMweb Gold

Very useful post, thanks Harlequin. I'll see if that app works for me, sounds like just the thing I've been looking for.

 

I've found that depth of field isn't always desirable - if you want to really foreground something for example - but in general it does make a huge positive difference.

  • Agree 1
  • Thanks 1
Link to comment
  • RMweb Premium

Thank you for a most helpful blog post.

 

I have a studio camera with movements. It's one of those things I wanted for many years, and then realised its limitations as soon as I started with it - mainly its bulk and its appetite for roll film. Anyway, I did apply it to model trains some years ago and here is an example of controlling DoF with movements. The lens is turned somewhat to the left, and also titled vertically to keep the vertical things upright. This photo is scanned from a negative but no subsequent editing. Can we can produce this sort of effect with focus stacking? That is, setting the area of focus diagonally across the depth of the subject. If so please do post up the details.

 

Original image (lost from RMweb server):

image.png.90184fffcdf6df7f7db44d71a8a9031f.png

 

Substitute image (might be different to the original):

2117563803_120roll3-003.jpg.9767d2b5ed946dcb2ec86d00bcaf3329.jpg

 

 

Edited by 47137
  • Like 1
Link to comment
  • RMweb Premium

Morning Phil 


Very interesting blog.

 

After the recent software changes, the images are missing on this blog, any chance of adding them back in?

 

Thanks.

 

On 29/03/2019 at 14:22, 47137 said:

Thank you for a most helpful blog post.

 

I have a studio camera with movements. It's one of those things I wanted for many years, and then realised its limitations as soon as I started with it - mainly its bulk and its appetite for roll film. Anyway, I did apply it to model trains some years ago and here is an example of controlling DoF with movements. The lens is turned somewhat to the left, and also titled vertically to keep the vertical things upright. This photo is scanned from a negative but no subsequent editing. Can we can produce this sort of effect with focus stacking? That is, setting the area of focus diagonally across the depth of the subject. If so please do post up the details.

image.png.90184fffcdf6df7f7db44d71a8a9031f.png

 

Can you add yours back in Mr 47137.

 

thanks.

Link to comment
  • RMweb Gold
2 hours ago, Neal Ball said:

Morning Phil 


Very interesting blog.

 

After the recent software changes, the images are missing on this blog, any chance of adding them back in?

 

Thanks.

 

Thanks. Images found and replaced.

 

  • Like 1
  • Thanks 1
Link to comment
  • RMweb Premium
6 hours ago, Neal Ball said:

Morning Phil 


Very interesting blog.

 

After the recent software changes, the images are missing on this blog, any chance of adding them back in?

 

Thanks.

 

 

Can you add yours back in Mr 47137.

 

thanks.

I have uploaded a photo which supports my comment (diagonal focal plane and upright verticals), but I am not sure if is my original photo - HTH

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...