MATTHEW NORDHAGEN :: PHOTOGRAPHY

USING THE FIND EDGES FILTER TO HELP FOCUS BLEND IN PHOTOSHOP

March 26th, 2020

When I have images that I need to focus stack I manually focus blend them into one image rather than use the Auto Blend feature in Adobe Photoshop. I find Auto Blend to not be terribly accurate — in my experience the final image often needs some additional masking to correct poorly masked areas.1 Manually blending is a surprisingly effective alternative and worth considering if you are experiencing similar issues with Auto Blend. While manual blending is effective it can be unclear at times whether you are blending the sharpest portions of every image. A useful guide in such cases is using the Find Edges filter.

According to Adobe, the Find Edges filter "identifies areas of the image with significant transitions and emphasizes edges." The areas with significant transitions will most likely be those that are in the plane of focus. Any area outside the plane of focus should result in fewer defined edges. This visual representation of the plane of focus for each image can be used as a guide for masking the final image. Below is the workflow that I follow when using this method.


Step 1. Open your sequence of images as layers in Photoshop. If you are using Adobe Bridge, select all of your photos and from the Menu Bar select Tools > Photoshop > Load Files into Photoshop Layers.



Alternatively, you can open Adobe Photoshop and from the Menu Bar select File > Scripts > Load Files into Stack.



Step 2. Regardless if a tripod has been used movement, however slight, may still be possible. The layers should be aligned to ensure seamless masking later. To align your layers, first select all layers in the layers panel then select Edit > Auto-Align Layers. Accept the default Auto projection. Then select OK



Photoshop will take a several seconds to align the layers. When complete, there may not be an obvious shift in the photos to suggest that an alignment occurred. You will likely need to zoom in well past 200% at the borders to see any result. In the example below, the red arrow indicates what a minimal alignment may look like. Although nearly unnoticeable, it is a difference that can affect the final layer masking.


Step 3. The next step is to prepare the layers to run the Find Edges filter. The Find Edges filter is a destructive filter. In other words, it will overwrite the layer contents with the result of the filter. To focus blend, at least one of the layers needs to maintain the original image. There are two options:

Option 1. Convert each layer to a smart object. Smart objects allow you to retain the layer content while using filters non-destructively.

Option 2. Create a duplicate for each layer and run the filter on the duplicate.

Smart Objects are typically the preferred method since they offer the most flexibility. However, creating duplicates is faster simply because you can bulk convert layers to duplicates. There is no equivalent shortcut to bulk convert layers to Smart Objects. To quickly create duplicate layers select all layers in the layers panel then right-click and select Duplicate layers. Alternatively, you can use the keyboard shortcut Command + J (Mac) or CTRL + J (Windows).



Move the duplicate layers so that they are paired with the original layers.



Step 4. Select the first duplicate in the Layers Panel, navigate to Filter > Stylize > Find Edges. The filter will run quickly. To view the result, turn off the visibility of the first layer in the Layers Panel. The darkest edges represents the sharpest focus. Edges progessively loose definition the further away you are from the plane of critical focus.



The plane of critical focus will become more apparent when the rest of the images have been run through the Find Edges filter. Below is a video that loops through all filtered images used in this example. This should provide an idea as to the approach that you will take when blending the final images from every layer. You will target the plane of critical focus in each image.



Step 5. Repeat Step 4 above and filter the remaining layers.

Step 6. Using these filtered layers, you will create guides on the first image that identify the sharpest portion of all images. The approach is simply visual. If you reference the video from Step 4 above, you will see common areas of focus overlap between the images. These are the areas to target when placing the guides. To create guides place your cursor in the ruler at the top of the document and drag down. This will create a cyan colored horizontel guide. Place a guide for every area with the sharpest focus.



Step 7. With the guides placed, you can either (1) turn off all filtered images or (2) group them into their own folder in the layers panel for reference later. I often group them. To group layers, select all filtered layers in the layers panel Right-click > Group from Layers.



Step 8. To begin masking, select the first image in the layers panel. Then, from the list of layer options at the bottom of the layers panel, select the Layer Mask button. Photoshop adds a white layer mask to the selected layer.



Layer masking is simply concealing and revealing areas using a Black or White brush. A good rule of thumb is "white reveals, black conceals". To activate the brush, select the Brush tool from the tools palette. Alternatively, the brush can be selected using the keyboard shortcut b.



Step 7. How the Brush Tool functions is largely controlled by the hardness, diameter, opacity, smoothing, and flow settings. Each of these settings can be accessed through the Brush toolbar at the top of your document screen. First, apply the following values to these settings.

  • Opacity: 100%
  • Flow: 100%
  • Smoothing: 10

  • Opacity controls color opaqueness and transparency. Flow controls how much of the color is applied with each stroke. Smoothing adjusts the smoothness of each brush stroke — the higher the value, the smoother the brush. The remaining two settings, hardness and diameter, control brush feathering and brush size, respectively. These setting are conveniently accessed through keyboard and mouse shortcuts as the video below briefly demonstrates.

  • Mac: Control + Option then drag mouse cursor accordingly to adjust hardness and diameter.
  • Windows: Control + Alt + right-click then drag accordingly to adjust hardness and diameter.

  • The diameter can also be adjusted using the bracket keys on your keyboard. The left bracket [ will increase the brush diameter. The right bracket ] will decrease the brush diameter.



    Step 8. The approach to masking is going to be similar to how the Auto Blend tool masks areas. A black brush will be used to conceal the areas of the active image to reveal the portion of the image directly beneath it. To select black from the color palette, press the x key on your keyboard. This will swap the foreground and background color swatches, with the foreground color being the active color. If your color swatches happen to be different colors press the d key on your keyboard to return to the default black and white color swatches. In the video below, the d key will be pressed first to return to the default color swatches and then x will be pressed to demonstrate swapping between them.



    Step 9. With black chosen as the brush color, select the layer mask for the first layer. You will target the immediate area around the guide. You can be reasonably confident that this area will not only be in focus but also share some focus overlap with the next image. This overlap, combined with a feathered brush, will help avoid hard breaks in focus between your blended images. During masking it can be useful to visualize the mask itself. You can do so by enabling the Rubylith overlay by pressing the \ (backslash) on your keyboard. The visibility of the guides can be toggled as well by pressing Command + H (Mac), CTRL + H (Windows).

    While you can manually brush in the layer mask, Photoshop offers a useful shortcut to automatically apply a mask. This is the method that I use and is demonstrated in the video below. First, mask in a single area with the brush. Then, hold the Shift key on your keyboard and move your mouse to the opposite end, and off the image, and left-button mouse click. Photoshop will automatically apply a mask between both points. What remains is to mask in the rest of the image below the guide so that the immediate layer beneath it is visible. This can be quickly done by increasing the size of the brush.

    Step 9 in its entirety is demonstrated in the video below (there is no audio) to further clarify the masking workflow. When masking is finished, I will quickly check to see if there are any obvious hard transitions in focus between the images.



    Step 10. Once I feel confident that the blended image is correct, I will finish by merging the masked layers to a new layer. Otherwise known as Merge Visible to New Layer. If you simply merge your layers Photoshop will flatten the image to a single layer. You will want to preserve the individual masked layers while creating a new layer with the blended results. There are two shortcuts, both of which accomplish the same task. The first shortcut is selecting the layers to merge then right-click and mouse over Merge Visible. While holding the Option key (Mac), or Alt key (Windows) select Merge Visible. Photoshop will merge the selected layers to a new layer while preserving the original layers. The second method is to use the keyboard shortcut Command + Option + Shift+ E (Mac), or Ctrl+ Alt + Shift + E (Windows).

    Step 11. Save the document and export the merged layer as an image file.

    I am the first to admit that this is not the most elegant solution to a problem that, for some, might be few and far between. The Auto Blend tool is preferable for a reason. It is simple, relatively quick, and can produce good results. However, alternative workflows have their place in Photoshop and can be useful when the preferred workflow doesn't produce the preferred results. You might have never had a problem with the Auto Blend tool but, if you do, this is one such alternative to keep in mind.


    1Auto Blend does work better with more images. Which could explain why my original attempt at using Auto Blend on the image exampled here did not stack correctly. However, this tutorial will hopefully illustrate that a focus stack can be produced outside of the Auto Blend tool in the event not enough photographs were taken out in the field to satisfy the technical requirements of the Auto Blend tool.