Earthbound Light - Nature Photography from the Pacific Northwest and beyond by Bob Johnson
Online Ordering
Recent Updates

Photo Tip of the Week

Focus Stacking: Breaking the Depth of Field Barrier

One of the technical challenges to overcome when shooting both macro and some landscape images is limited depth of field. As with many things though, the digital darkroom is rewriting the rules. Welcome to "focus stacking."

To understand the problem, it's important to first understand that a lens is really only ever focused at some certain distance. No lens is ever truly in focus at anything more than that one distance. You can change that distance of course, but the focus point will just shift to a new single distance. But just in front of and just behind that distance things will look close enough to being in focus that we really can't tell they aren't. Things look close enough to being in focus that we can consider that they are, even though in fact they are increasingly out of focus as we diverge from the actual focus distance. We can start to tell that things look a bit soft once we get far enough from that distance, and at some point this will become painfully obvious, but within a certain range things will look in focus even if technically they aren't. The range where things look like they're in focus is known as the depth of field.

At increasing magnification, depth of field becomes quite shallow. This leads to some hard choices if your subject is bigger than the available depth of field. Even when shooting larger subjects depth of field can sometimes be problematic. Shooting a field of mountain wildflowers when the wind is blowing can also lead to hard choices. Stopping the lens down to get enough depth of field so that everything is in focus can force you to need shutter speeds long enough to blur shots from subject movement. Keeping the shutter speed fast enough to freeze the action and overcome the effects of the wind will mean you have less depth of field to work with and may not let you keep everything you want in focus.

So what's the answer? Well, the traditional answer for macro shooting has been to carefully align the camera back to the main plane of the subject to maximize the usefulness of whatever depth of field there may be. The traditional answer for that field of mountain wildflowers in the wind has sometimes meant coming back later when the wind isn't blowing. But as I mentioned at the outset, digital editing creates new possibilities for overcoming old problems. In order to get more depth of field than your camera and lens can give you, you can digitally merge a series of shots taken at different focus distances to form a single composite image using a technique known as focus stacking.

If you're already familiar with stacking images shot at different exposures to form a composite HDR image that exceeds the ability of a camera to capture, you can probably already guess how focus stacking works. In order to shoot for focus stacking, you need to create a series of shots that cover every part of your subject in focus in at least one shot. Start by focusing on the closest point of your subject. Then refocus a little ways further into the scene and shoot again. Keep doing this until you have a shot focused as the farthest away part of your subject. Each shot should overlap the depth of field of the next in order to ensure you really have everything covered sufficiently. As with shooting for HDR, it is better to shoot too many shots even if you later decide not to use them all than it is to risk shooting too few and not having sufficient coverage.

Make sure that the only thing you change between shots is the focus distance. Keep the aperture, shutter speed and everything else the same. Set the camera on manual exposure even if you initially use Program mode to determine what settings to use. Generally pick an aperture in the middle of the range your lens provides since this is often the "sweet spot" for that lens. Don't be tempted to shoot everything at f/22 to get away with as few shots as possible. Polarizers can work, but if you use one you need to make sure it stays aligned at the same angle for each shot. If the front element of your lens rotates when you focus this may not be as easy as it sounds.

Once you get your shots onto your computer, it's time to get to work combining them. Don't be surprised that not a one of them looks all that good to begin with. When shooting traditionally, the aim is to carefully focus so as to optimize the available depth of field to best cover what you are shooting. When shooting for focus stacking the strategy is simply to change the focus ring and press the shutter release over and over so it is quite likely that no one shot has anywhere near optimal depth of field. You'll need to combine the depth of field from multiple frames to get what you are after.

There exists a growing list of software programs that can help you do this. I'll take a more detailed look at three of them next week but the process is similar for each. After loading all of the source images, the software analyzes each pixel to determine which frame has the highest contrast at that point. Regardless of how much contrast each point is supposed to have, blurring the image by defocusing will give you even less so the frame with the most is the winner for that point. Unless of course that point had no contrast to speak of there to begin with, in which case blurring it won't hurt or help. If everything were completely uniform around that point, there would be nothing to blur so no harm, no foul regardless of which shot gets used. When in doubt for a given point, all these programs tend to pick source images from which they have already picked adjacent pixels.

These programs also have to contend with situations where the source images don't exactly line up with each other. Sometimes this is due to slight camera movement when refocusing. Sometimes this could be caused by subject movement such as those flowers in the wind. But one cause you may not have thought of is the fact that changing the focus of any lens also slightly changes magnification. Lenses focus by moving elements close or further away from the sensor. But when magnification increases, an image will become cropped more tightly. This means that combining images shot with the lens focused differently requires some frames to be enlarged slightly to line up with the others.

Thankfully, all this is handled more or less automatically for you by the software. How successful they are at doing so is what makes some of these programs better than others. But for more on that, you'll have to wait for next week's article.

Date posted: April 24, 2011 (updated May 1, 2011)


Copyright © 2011 Bob Johnson, Earthbound Light - all rights reserved.
Permanent link for this article

Previous tip: On The Level: Making Peace with Crooked Horizons Return to archives menu Next tip: Options for Focus Stacking Software

Related articles:
Depth of Field, Part 2
Depth of Field, Part 3
Depth of Field, Part 1
Close-up: Depth of Field and the Film Plane
More on Factoring In the Crop Factor: Depth of Field
Options for Focus Stacking Software
Focus Stacking: Getting the Shots in the First Place
Stacking and Stitching: An Overview of Multi-Shot Techniques
Stacking and Stitching: So is All This Real Photography?
Thank You, Captain Scheimpflug
Judging Depth of Field in a Modern Digital World

Tweet this page       Bookmark and Share       Subscribe on Facebook via NetworkedBlogs       Printer Friendly Version

Machine translation:   Español   |   Deutsch   |   Français   |   Italiano   |   Português

A new photo tip is posted each Sunday, so please check back regularly.

Support Earthbound Light by buying from B&H Photo
  Buy a good book
Click here for book recommendations
Support Earthbound Light
  Or say thanks the easy way with PayPal if you prefer

Home  |  About  |  Portfolio  |  WebStore  |  PhotoTips  |  Contact  |  Comments  |  Updates  |  Support
Nature Photography from the Pacific Northwest and beyond by Bob Johnson

View Cart  |  Store Policies  |  Terms of Use  |  Your Privacy