Accessibility

Add depth of field with Lens Blur

 

Created:
27 February 2004

If you’ve ever snapped a photo and had it developed, you know that whether you like it or not, some parts of your subject matter remained in focus and some did not. If your camera has dials that you can fiddle with (as opposed to the point-and-shoot type of camera), you can use the f-stop to control the “depth of field” of the image, or how much of the image is in focus. Objects that fall outside (are in front of or behind) the depth of field will look blurry. The appearance of the blurred area will vary depending on the individual camera lens and camera model. For example, blurred white highlights, which photographers call specular highlights, can vary in shape and intensity.

The Lens Blur filter in Adobe® Photoshop® CS attempts to replicate the blurring that a camera lens produces (Figures 1-2). What previously required the use of multiple channels, gradients, and editing steps can now be accomplished in one dialog box. All of this number crunching comes at a price, though: it can be slow when applied to large images. Also, it can’t be applied to 16-bit images.

phs8pplensblur_1

Figure 1: The original image, entirely in focus

phs8pplensblur_2

Figure 2: After applying the Lens Blur filter to blur the pumpkins in the background

To apply the Lens Blur filter:

  1. Choose a layer in an image that’s entirely in focus.

  2. Create an alpha channel that contains a gradient. Or for the selected layer, create a layer mask that contains a gradient. The white part of the channel or mask gradient can be matched up with an area in the photo that you want to remain in focus. The white and black areas of the gradient can be switched from within the Lens Blur dialog box. Click back on the layer thumbnail. Later, you’ll choose that alpha channel or layer mask as the Depth Map source.

    Note: If these instructions seem overly complex, come back and visit after you’re more comfortable using either gradients or masks.

  3. Choose Filter > Blur > Lens Blur. The Lens Blur dialog box opens (Figure 3). Choose Fit in View for the zoom level.

    phs8pplensblur_3

    Figure 3: The Lens Blur dialog box. We clicked on the tip of the foreground pumpkin to make that the point of focus.

  4. At any time while you’re making adjustments, you can uncheck, then check Preview to toggle between the original image and the blurred image.

    You can also change the zoom level for the preview by clicking the zoom button in the lower left corner of the preview window or by choosing a preset zoom level from the zoom level pop-up menu.

  5. The grayscale values in a Depth Map control where the blur is applied, mimicking the depth of field in a camera. In the Depth Map area:

    From the Source pop-up menu, choose a source for the Depth Map (the grayscale values in the source will control what’s in focus). Choosing None, or a source that is one overall value (such as flat color background), will result in uniform blurring across the image.

    Move the Blur Focal Distance slider to specify which grayscale value (0–255) in your Depth Map is to remain fully in focus. The higher the value, the shorter the depth of field. Values lighter or darker than this value will become progressively more blurred and will look as though they’re either in front of or behind the areas that are in focus.

    Or you can click in the preview on the area you want to keep in focus. Actually, what you’re really doing is choosing a grayscale value that’s located in that part of the chosen channel or mask (it’s not visible, but it is aligned with the image) (Figure 4).

    phs8pplensblur_4

    Figure 4: The original image contains a layer mask, which is composed of a gradient.

    This layer mask is chosen as the Depth Map source. When you click the dialog box preview, you're actually choosing a grayscale value becomes the Blur Focal Distance value. Image pixels at the location you clicked remains in focus; all other image pixels become progressively more blurry (blurring at the same rate as the gradient transitions to black).

  6. Check Invert if you want to switch the white and black areas in the Depth Map.

  7. Use the settings in the Iris area to specify the size and shape of the camera lens’s iris, or aperture:

    From the Shape pop-up menu, choose the number of blades that create the lens opening.

    The Radius value controls the size of the iris opening and the amount of the blur. It has the most pronounced effect of any option in the dialog box.

    Choose a Blade Curvature value for the curvature on the blade shapes. Choose a Rotation value to rotate the iris opening.

    As the number of blades and the blade curvature increase, the shape of the iris becomes more circular and the shape effect becomes harder to discern. The shape will be most noticeable in the specular highlights of an image.

    If all of this seems overly complex, you can just experiment with different settings until you achieve the look you want without paying too much attention to the mechanics of how it works.

  8. Blurring averages the values of neighboring pixels and tends to gray out white specular highlight areas. In the Specular Highlights area, you can use the Brightness slider to brighten highlight areas that have become blurred, and use the Threshold slider to control how many pixel levels are affected by the Brightness setting.

  9. Blurring can also affect the film grain in an image, creating a nonuniform texture. To add Noise back to the blurred areas, do any of the following:

    • Move the Noise: Amount slider.

    • Click Distribution: Uniform or Gaussian.

    • Check Monochromatic if you want to limit the noise to just grayscale pixels instead of color pixels.

Excerpted from Photoshop CS for Windows and Macintosh: Visual QuickStart Guide, Copyright ©2004 by Elaine Weinmann and Peter Lourekas, published by Peachpit Press. Used with the permission of Pearson Education and Peachpit Press. To buy this book, visit www.peachpit.com.