A Technique to Increase Depth of Field of an Image
Ever notice how little is in focus when taking close-up images, even with the lens set at f/22? At the closest focus distance of a 100mm macro lens of 12 inches, the depth of field is only .33 inches at f/22 with a full-frame sensor, and only .21 inches with a cropped sensor body. Well, there’s nothing to be done about the laws of physics, but there is a technique that can be used to increase the range of focus in digital images. Focus stacking is the merging of the sharp sections of multiple image captures of the same scene. I became interested in this technique as an avenue to increase the depth of sharpness in my macro images, but it can also be useful in landscape images when circumstances require. What I most desire from this technique is the ability to have a subject sharp from front to back while maintaining a pleasing out-of-focus background.
I started my experimentation by capturing a series of images of an orchid on a recent trip to Costa Rica. At f/22, the range of focus did not capture the right and left orchid sepals in focus, and even if it did, such a small aperture resulted in more detail in the background than I wanted as seen in the first image below. I captured six images at f/13 with the intent of getting all parts of the orchid in focus, while rendering the background as softly out of focus as possible. I used a stacking technique in Photoshop CS5 to align and merge the images together. The second mage below is the composite image and even in this small sized image the complete focus of the flower and the more pleasing background blur are obvious.
This process is not a magic panacea for increasing depth of field. As this was my first time using this technique, I had several surprises; the composite orchid image was surprisingly well assembled, pulling together all the sharp elements of the image. However, there were some anomalies that required further editing to clean up the image, more about that later. Overall I was pleased with the result and throughout the summer I used the technique when the opportunity presented itself. My goal was to photograph a Rattlesnake Orchid that has been growing along the edge of the wooded section of my yard since 2005, and it has blossomed only twice; in 2008 and again this year. The blossom is a stem of many tiny orchids that grow in a spiral around the stem. I wanted to document this beautiful flower as well as the stages of growth, if I could.
One situation that focus staking serves as a useful tool it photographing a cluster or group of small subjects such as a cluster of mushrooms growing on the side of an old moss covered wood pile. The mushrooms I found have a deep ridged structure to the underside of the cap, and I wanted to capture this detail in a cluster of mushrooms. The span from the front edge of the mushrooms to the back edge of the most distant mushroom were about one inch. The first image is a single capture taken at f/22 and the second image is the composite image using 12 captures each at f/14 at 1/20 second and were aligned and merged using the Photoshop technique. The images were captured with a Canon 7D and Sigma 150mm f/2.8 macro lens mounted to a sturdy tripod. The starting point for capturing was determined by observation; I looked at the cluster of mushrooms from an angle that I could determine the edge closest to the camera, as well as the edge farthest from the camera.
To ensure accurate focus, and to accurately judge that the next section of the flower to be in focus overlapped the previous section, I used the Live View feature of the camera. Instead of viewing the image through the viewfinder to compose and focus, live view lifts the mirror in the camera and displays what the sensor will capture in the display on the back of the camera. It also has a feature to enlarge a small portion of the image, allowing critical focus.
When using a small aperture such as f/22, even a distant background shows some definition. In this example, while f22 captures the spider with adequate depth of field (DOF = .43 inch in this case), it results in too much detail in the background. As can be seen in this side view of an arrowhead micrathena, the distance from the top of the spinerets to the “arrow tips” of the abdomen is about 3/16 inch. To complicate matters, the spider was hanging from the center of the web. To isolate the spider and web from the background, focus stacking provides enough depth of field by blending several layers captured of the subject without extending significant depth of field to the background. The first image below is a single capture of f/22 and the second image is a composite of four captures at f8.
For the spider image, the web was also moving slightly in the breeze. Photoshop’s auto-align handled the slight offsets in position for each capture very well, and no artifacts from the process were evident.
Another good use of the focus stacking technique is the case where the subject is essentially flat, but the camera cannot be positioned so that the sensor plane is parallel to the subject. For this example I photographed water droplets on a window pane that formed due to condensation. A similar situation would be frost on the window in winter. I set the camera at an angle of about 15º in order to create the misalignment. The first image is a single capture at f/22. There is evident lack of sharpness on both sides. The second image is the last slice of 8 captures at f/8 with the right edge of the image in focus and the left side significantly out-of-focus. The thrid image is the 8 slice composite image and is sharp from edge to edge.
Focus staking has been demonstrated to be a useful tool to increase depth of field in these situations. There are anomalies that sometimes arise; some of which are easily fixed and others that are impossible to fix. In Part 2, I’ll present some of the image processing errors I discovered, and describe some methods to edit the final images. I’ll also describe my tests of the Helicon Focus software, a product specifically designed for focus stacking.
Thank you, Dennis, for a wonderful presentation, clear and precise, of this technique.
I had lots of fun using it for some flower pictures, taken to test the railing recently bought for my camera.
Dennis, thank you for this informative post. I’ve recently become interested in panorama’s using stitching and alignment in photoshop and find your post on stacking will have me trying your techniques very soon.
When photographing a flat object, like the window droplets you mentioned you tilted your camera 15 degrees to cause a misalignment. Would you mind explaining further what exactly is a “misalignment” and why you would want to do it? What does it do?
Jim,
I took the images of the droplets on the window to demonstrate the technique of stacking the images together. Normally, I would have arranged the camera to have the sensor plane parallel with the window, but then all the drops would be in focus. I created the need for focus stacking by tilting the camera so that only a section of each image would be sharp. Perhaps “misaalingment” is the wrong word to use since all the images are actually aligned as they need to be for focus stacking.