Showing posts with label hyperfocal. Show all posts
Showing posts with label hyperfocal. Show all posts

Thursday, 18 February 2016

Get Amazing Depth of Field with Focus Stacking


When we think about creating a photograph with everything in sharp focus from a few centimetres in front of the lens out to the horizon, we immediately think that we will need to ‘stop down’ to an incredibly small aperture and focus at the hyperfocal distance. Unfortunately, that means we will have to use extremely long time exposures to make up for the light lost with the small aperture, and who knows where the hyperfocal distance is anyway!?

You could invest heavily in a tilt/shift lens instead, but there is a way to use your current lenses to get this result. I am going to describe the procedure on the assumption that Photoshop is available to you, but there are inexpensive software packages available as well to perform what is referred to as focus stacking (Google it).

Before we get to the software, let’s outline the image capture procedure. The idea is to capture a number of images of the same scene (a tripod is a must for this), successively refocusing from closeup to infinity in small steps. The successive images must overlap in terms of focus. For this reason, it would be wise to use a fairly small aperture (like f/16, if the light allows), in aperture priority or manual mode, to give each shot as wide a depth of field as possible. Small focus steps will ensure the in-focus zones from one shot to the next overlap each other. This will require some experimentation with your lens. Take as many shots as you want. This will guarantee a good result, and the software will have no problem handling them.

Note that as you refocus, the size of the image changes slightly. For that reason, the first job of the software is to align all of the shots based on their content. Because each shot contains zones that are out of focus, the next job of the software is to blend the images together while removing the defocused zones from each.

When aligning the shots, the software creates a layered file comprised of each shot on a different layer (hence the ‘stacking’ term). To eliminate the defocused zones, it adds a mask to each layer which blocks out these zones individually.

So here are the steps I use in Photoshop. It is possible to align and blend all shots at once, but I found it gave me screwy results. Instead, I do the following:

1.       Open all of the shots in your sequence (at the same time to save time)

2.       Select File > Automate > Photomerge.

3.       Under Layout in the dialog box, select Collage. Under Source Files click Add Open Files. Uncheck the Blend Images Together box (I do this to avoid the aforementioned screwy results). The software creates a new, layered ‘Panorama’ file with content on all layers now aligned. Note that you will probably have to crop the edges where overlap did not occur.

4.       Highlight all layers using Shift-Click or Ctrl-Click. Select Edit > Auto-Blend Layers…, then check the Stack Images radio button and OK.

Now here’s where it can get a little tricky. If you zoom in to the resultant image and find some soft-focused areas, it means Photoshop didn’t quite get the masks right in that area. If you find a number of these areas, the fix will take time and patience. You can turn layers on and off by clicking the eyeball icon on each layer. With all layers turned off except one, you will clearly see where the mask on that visible layer has eliminated part of that layer (checkerboarded areas). By stepping this way through all layers, you will see where the trouble spots are. You may need to erase these areas from one mask (where Photoshop has left in a defocused area) and add to the mask on another layer where that area is in focus.

How do you subtract from or add to a mask? Click on that mask (the rightmost rectangle on a layer), select the Brush tool from the tool palette and choose the white patch from the bottom of the palette, and paint the image. You will see this reveals more of the image on that layer; in other words, it is removing part of the mask. To cover up part of the image on a layer (in this case, a defocused area for instance), use a black brush. Adjust the size and hardness of the brush to get the desired control. As I said, this can involve a lot of work.

First Image in Sequence
The sample images here show the first and last images in a stack sequence, and the resultant focus-stacked image. The actual number of images in the stack was 11, but the first and last images demonstrate how the background and foreground, respectively, are distinctly out of focus.  All shots were made at f/6.3, so each has a shallow depth of field. Despite that, the resultant image looks terrific.

Last Image in Sequence
Of course, if you have decent light you could avoid using focus stacking by using a very small aperture such as f/22 and focusing at hyperfocal distance. But this too requires skill in determining the right focus point.

Focus stacking may be too over-the-top for many, but if you are passionate about pushing your photography up a notch, your efforts will be greatly rewarded by trying it.


Focus-Stacked Final Image

Saturday, 25 August 2012

Depth of Field: Choosing the Right Focus Point


Most of the time, when we want to get everything in our shot in focus from our feet out to infinity, the tendency is to dial in as high an aperture number, or f/stop, as possible. In doing so, we hope to increase the depth of field in the image, or the range from our near in-focus point to our distant in-focus point.

But there are two other parameters that have a dramatic effect on depth of field: focus point and focal length of the lens. Two rules of thumb for increasing depth of field are

·         Manually focus as far away as you can from your subject while still keeping them in focus at the aperture you are using, and

·         Use as short a focal length as you can to compose the shot.

Take the second point. We’ve all seen wildlife and sports shots that are taken with a very long focal length lens. The subject is very sharp while the background and foreground are very much out of focus (shallow depth of field). So, conversely, using a short focal length (or wide angle setting) results in a deeper depth of field.

Choosing the focus point, however, is probably the most critical parameter in achieving the shot you want. The first point above implies that the further away from the camera that you focus, eventually you will have everything in focus from a point close to the camera out to the horizon (infinity). To put a label on it, when this happens, you are focused at the hyperfocal distance. This term is mostly of interest to landscape photographers but the point is that, counter-intuitively, we need to focus beyond our subject to get it and the background appearing sharp.

The best graphical demonstration of this is the Online Depth of Field Calculator at www.dofmaster.com. Choose your camera model, focal length, aperture and subject distance. Assuming you focus on your subject, the calculator tells you the near focus and distant focus points. The difference between these is the depth of field.

Hyperfocal distance is also illustrated. If you focused at this distance, everything would be in focus from the distance shown in the illustration out to the horizon. Note that sometimes hyperfocal distance won’t get your subject in focus because the near focus limit is further out than your subject. In this case, you would have to use a higher f/number, shorten your focal length or resign yourself to not having the horizon in perfect focus.

The following images were shot using highly sophisticated dollar store markers at 5 foot intervals. The closest was 5 feet from the camera’s sensor. The camera was a Canon Digital Rebel using a fixed focal length of 35mm in all examples. Each image has been cropped from the originals.

In the first image, aperture was set to f/22 and focus was manually set to the calculated hyperfocal distance of 9.5 feet (just in front of the second marker).  Notice that the 5 foot marker is still in focus, as well as the tree top a couple of  hundred feet away (See insert). This is because the near focus limit is calculated to be 4.7 feet. (Note that the insert looks a little soft because the sensor resolution is starting to come into play.)


 
The second image was also at f/22, but the camera was now focused at our subject, the 5 foot marker. The calculator tells us that if we focus at 5 feet rather than the hyperfocal distance, our focus range now covers 3.3 feet to 7.2 feet. So our depth of field has now decreased from infinite to 3.9 feet just by focusing at 5 feet rather than 9.5 feet from the camera. Note that the markers at 10 feet and beyond are a little softer, and the tree top is no longer in focus (slightly softer).

 

At f/10, our next image was focused at the calculated hyperfocal distance of 21.1 feet (just past the lowest 'lollipop'). The near focus limit is calculated at 10.5 feet, and indeed the second marker at 10 feet is very slightly soft. The tree top, while not perfectly sharp, is close to being in focus. I chalk this discrepancy up to difficulty in getting the focus exactly at 21.1 feet. Note that our subject at 5 feet is badly out of focus, so f/10 is clearly not a good choice if we want focus from 5 feet to the horizon.

 
 
Still at f/10 in the last image, the subject at 5 feet was once again our focus point. Calculated near and far focus limits are 4.1 feet and 6.5 feet, giving a depth of field of only 2.4 feet.


 

The conclusion? Decide whether you want to shoot like a landscape photographer or whether a little bit of in-focus background will suffice for your shot. Even if you don’t use hyperfocal distance, the calculator will help you choose a manual focus point beyond your subject that will keep it in focus but still give you a decent background focus.