Anomalies and (some) Fixes
As I experimented with capture and processing of images for focus stacking, I discovered some recurring anomalies that I had never heard about in any presentation or article that describe the technique. This is most disappointing if you rely on reviews and articles for product information, in addition to the advertisements, when making a purchase decision.
When capturing the images for a focus stacking operation, the focus point of the lens is set on various parts of the subject. This can be done in one of two ways; by adjusting the focus distance while keeping the camera position fixed, or by adjusting the camera position while keeping the focus distance fixed. One image presented three anomalies all related to the varying image magnification as a result of changing the focus distance. The focus slices taken of the orchid image below were accomplished by changing the focus distance with the camera in a fixed position on a tripod.
While the image layers all have the same pixel dimensions, it can be readily seen that the image content is different due to the slight difference in field of view that occurs from changing the focus distance but leaving the distance from the camera to the subject unchanged. The image of the orchid shows the difference in field of view of the closest and farthest focus of the six images after the images have been aligned by Photoshop. Photoshop’s auto-align feature will change the dimensions of the images so that the image content is aligned. Small variations will be ignored and most of the image elements will be aligned.
Keep in mind that the camera position was not changed during the series of images, but only the point in the image on which focus was set. In the above example the center image is the closest point of focus as evidenced by the near tip of the orchid’s sepal in focus.
Once the captures were aligned and merged, several anomalies were evident. One surprise was several series of black dots in the image. It took a while to realize these were out-of-focus insects in the background which were in a different location for each image capture in the stack. If they had been stationary objects in the background, they would have presented as one dot when the layers were aligned. I found the easiest way to eliminate this problem was to use the Spot Removal tool in Lightroom on the six image captures before merging them together. Another phenomenon was what looked like pinched paper along the edges of the merged image. I found that these are transitions between the edges of one image with that of another and larger image. As noted earlier the software changes the size of the image in the stack so that elements of the image are aligned causing an overlap of the edges of one layer with the next layer; the software must occasionally sense this as a sharp feature and preserves it in the composite image. This is easily fixed in the final image with cloning if it occurs, or by cropping if it is prevalent and fixing will take too much effort. Also, with the exception of this image stack the phenomenon rarely occurred on other images stacks that I made. In any case, with Photoshop merged images, edge cropping is often required. The effect along the edges of a stacked image usually present as bands of non-overlapping areas of the farthest slices. These are easily cropped from the composite image. Another edge effect is the transition of an element at the edge of a smaller layer with the same item that extends into a larger layer but at a different focus, which is also easily rectified by cropping. For this orchid I opted to layer in the whole leaf by merging the layers of the stack, added one of the images in the stack of which the leaf looked the best, and used a mask to blend the leaf to the stacked image. With the exception of the leaf in the lower left corner of the image, the edges consisted of distant out-of-focus background and no bands were evident, which is the reason for cloning in the full leaf in the corner.
Having waited all spring, my first images of the rattlesnake orchid were of the flower stem rising from the leaves, whose pattern gives the plant its name. The first image is a single exposure at f/22 and you can see that although the front leaves and the stem are in focus, the background leaves are out-of-focus. The second image is a 13 image stack taken at f/8 and you can see the improvement of sharpness from the front leaf to the back edge of the rear leaf. In addition, f/8 allows the background forest floor to remain somewhat out-of-focus, certainly enough to make for a more pleasing background.
The last two images are the first and last images in the stack and it is obvious by looking at the edges of the leaves near the sides of the image, that a significant shift in magnification as the lens is focused. Not a problem though, as Photoshop clearly accommodates this in the auto-align algorithms. However, it may be a good practice to check the composition at both the closest and farthest focus points to ensure that all important subject elements are in the frame before starting the image capture process. The distance from the front of leaf tip to the distant leaf tip in this example was 3.5 inches.
Now all I needed to do was wait for the blossoms to appear and I would be all set to photograph this interesting orchid. The images above were captured at the end of June, and I waited until early August for the orchid to develop so that some blossoms would be fully deployed.
The dimensions of the orchid’s leaf structure remained the same as the previous images; however, the stem had grown to be nine inches tall with the flower head at the top of the stem being two inches in height. Each fully deployed orchid blossom was .25 inches tall. If I captured the images to include the leaves as well as the blossoms, the details of the orchid would be minimized. My interest being in the structure of the orchid blossoms, I opted to photograph about the top two inches of the flower. Unless otherwise noted, all the images in this article were taken with a 5D Mark II and Sigma 150mm f/2.8 macro lens. The camera and lens were cradled on a beanbag on the ground, and light was provided on the flower by a 160-LED light panel on a small stand with natural light on the background. All of the images in this article have no sharpening applied to the composite images so that the effects of focus stacking can be better observed.
My first set of image slices were taken at f/8 at 1/25th second exposure. I made five captures starting with the focus point on the blossom in the lower left of the image. There is some image shift in the captures as I had to press buttons on the back of the camera to change magnifications on the display, and the camera position shifted slightly for each image since it was on a bean bag close to the ground. While a more stable tripod is preferred, this setup was adequate since the alignment function in Photoshop corrects the slight image shift. The five captures were selected in Lightroom, exported to Photoshop as layers in a single image, auto-aligned and auto-blended. The final image was cropped to eliminate dead space to the right of the flower.
A second set of captures was made with the camera/lens at its greatest magnification (closest focus). I took seven images from front to back at f/8 at 1/25th second exposure. The seven captures were selected in Lightroom, exported to Photoshop as layers in a single image, auto-aligned and auto-blended, and then cropped slightly to trim the edges. The resulting image looked good at first glance, but some areas of the image looked odd. The edges of some of the blossoms in the front of the plant appear to have halos and this occurs when there is another orchid or stem behind it. The stem is in focus except in areas near the edge of a blossom.
There are no less than 16 areas in this image that exhibit this effect. Is it a shortfall of the Photoshop auto-blend algorithms? I decided to process the same captures with the Helicon Focus software which is designed specifically for focus stacking, taking advantage of their 30-day free trial. The resulting stacked image, using the same captures as the previous image, was initially disappointing since the software was specifically for merging focus slices.
The two images below are an enlargement of the Photoshop auto-blend (left) and the Helicon Focus (right) processed images. On the left image, all three circles identify an out-of-focus band around the orchid. In the right image, the red area is much the same in both images. The blue area is handled better in Helicon Focus; there is still an out-of-focus band, but it is smaller. In the green area, it was not better, just different, having a different type of haloing in the Helicon Focus image. However, the structure of the blossom parts were much better handled in Helicon Focus, and obvious errors in the Photoshop merged image are identified by black circles. For convenience, a side-by-side collage of the two images is provided below.
Side-by-side comparision
There was another anomaly in the Helicon Focus composite image; it did not handle the out-of-focus background very well. After seeing this, I went back to the original captures and saw that the background of the flower did change brightness from image to image. The light on the flower was stable as it was lit with an LED lamp; however, the background (forest floor) was naturally lit and no measures were taken to control that illumination. The passing clouds varied the light on the background during the capture of the seven focus slices. Helicon Focus does not seem to handle that situation well. To be honest, at the time I did not study the capabilities or adjustments available in Helicon Focus. There may be some way to adjust for the proper merger of this type, it’s just not obvious. Photoshop on the other hand did a great job of merging the various background tones.
Closer inspection of the images processed with Photoshop show the same phenomena, a halo effect on the edges of a sharp foreground subject when it is overlapping a sharp background object. At first I thought I must be doing something incorrectly so I looked closely at the image files provided as a sample in the Helicon Focus. The same phenomena appear in this composite image, and it doesn’t change when the 25 captures are processed using the Photoshop technique.
Without doubt I consider focus stacking to be a valuable technique and set out to better understand the process, when it works best, and when it works poorly. I continued to capture image sets for focus stacking with the goal of better understanding the limitations of the technique and the software. In Part 3, I’ll present some examples comparing the performance of Helicon Focus and the Photoshop auto-align,/auto-blend, and the results of some experiments to explain the halo phenomemon.
Mike Luciano says
Dennis,
Outstanding presentation of this information. Kudos to you Sir.
Thank you,
Mike