Precise Gaussian Blur

The Precise Gaussian Blur transformation is a refinement of Gaussian blur that provides more accuracy and control at the expense of slower performance.

Gaussian blur is very fast for two reasons. First it does not actually perform a true Gaussian blur -- instead it computes an approximation by performing two passes of a so-called box filter. Box filters have the advantage that they take about the same amount of time to apply regardless of the blur radius, while most other kinds of blur take a time proportional to the square of the radius. The second reason is that blurring is done in two passes -- first each row of the image is blurred horizontally and then each column is blurred vertically. The two one-dimensional blurring passes are significantly faster than a single two-dimensional pass.

Precise Gaussian has several advantages:

1)Convolution is performed with a true 2-dimensional Gaussian kernel which is the mathematically correct method. Gaussian Blur is performed with two passes of a box filter.

2)Pixels can be excluded from the blurring computation to prevent halos when selective blurring is performed.

3)You can use a radius amount mask to vary the blurring radius for different parts of the image.

4)Fractional radius settings are supported so you can fine tune the amount of blurring.

The one big disadvantage of Precise Gaussian blur is that it is much slower than regular Gaussian blur -- especially when the radius gets large. Because of this, the maximum blur radius is currently limited to 64 pixels.

Using Precise Gaussian

Amount

The amount control lets you control how much of the precise gaussian transformation is applied to the input image. You can apply a percentage of the transformation to the entire image, or you can specify an amount mask to restrict the effects of the transformation to only part of the input image.

Blur

This control lets you blur all three channels of the input image (Normal) or just the color information (Chroma Only). Blurring chroma only can help reduce color noise without affecting the brightness (luminance).

Radius

The Radius slider works exactly the same as for Gaussian blur. Larger radius values produce more blurring, although the same radius value produces a little less blurring with Precise Gaussian than with Gaussian.

Radius Amount

This control lets you apply different amounts of blurring to different parts of the input image. The regular Amount control does not affect the blurring -- it simply lets you blend the blurred image with the original image. This produces an effect a little like a double exposure of a scene with one image sharp and the other blurred. Using a radius amount mask (see below), you can vary the blurring radius anywhere from 0% (no blurring) to whatever value the radius slider is set to (100% blurring). This can be used for example to keep the center of an image sharp and gradually soften the edges or to blur everything in a portrait except the eyes.

Mask

The mask is used to select what parts of the image to blur and what parts to leave alone. Note that the part you want to blur must be white and the part you want to leave alone must be black as illustrated in the example shown below. This mask is used a little differently from the mask in the Amount control.

The Amount mask acts as if the entire image was blurred and then selectively blends the blurred image with the input image. The difference shows up when you set the amount to somewhere between 0% and 100% in which case the output image looks like a double exposure of a blurred and a sharp image -- an effect something like a fog filter.

Blurring is done at each pixel in the input image by computing a weighted average of the neighboring pixels. The larger the radius, the larger the neighborhood. Now consider the example of a flower against a background where you want to blur just the background and keep the flower sharp. The neighborhood of background pixels near the edge of the flower will include some of the pixels from the flower as well. This causes the color of the flower to bleed into the background causing a halo around the flower (see examples below). The Mask control lets you define what pixels to include and what pixels to exclude from each blurring neighborhood. By creating a mask that is white for the background and black for the flower, you can exclude flower pixels from the blur and eliminate the halos.

Threshold

The Threshold slider works a little differently from Gaussian blur. When the threshold is set at 100%, everything is blurred. At lower values, those pixels that differ from the pixel being blurred by more than the threshold do not contribute to the blurring process. This preserves edges and other abrupt transitions while blurring smooth areas. By contrast, the regular Gaussian blur compares the fully blurred image to the input image and based on the threshold, either the blurred or the original pixel is passed through to the output image. This means that pixels rejected by the threshold test can still bleed into the blurred image and create halos.

Preview

A 1:1 preview of the blur effect is displayed in the right-hand side of the dialog box. Clicking on the input image display centers the preview on the location you clicked on, or you can click and drag to scroll the preview window.

 Preview Button

Clicking the Preview button causes the full output image to be recalculated, not just the preview area. This can be useful if you want to view the entire image at once and not just a small section, but it can take longer to compute.

 

Examples

If you are blurring an entire image with no mask or threshold, the difference between blurring with Precise Gaussian and regular Gaussian is insignificant and there is no advantage to using Precise Gaussian. There are however situations in which you can use Precise Gaussian to your advantage.

Blurring the background behind an object

One advantage of Precise Gaussian comes into play when blurring the background behind a foreground object. This requires that you have created a mask that isolates the object from its background. The mask must be white in the background areas (the part to be blurred) and black in the foreground areas (which will remain sharp). If you blur the background using the regular Gaussian blur, colors from the foreground object bleed into the background and can create a halo around the foreground object where its color differs from the background. Using Precise Gaussian eliminates the halo giving a far more realistic look. Precise Gaussian also allows for fractional radius values which gives you finer control over the degree of blurring, although for the same radius it blurs somewhat less than Gaussian.

Example:

         
                                Input image                                                                               Mask

                 
                                  Gaussian                                                                       Precise Gaussian

Reducing chroma noise

Because pixels that exceed the blur threshold (as specified by the Threshold slider) are excluded from the blurring process, the Precise Gaussian blur actually implements a bilateral blur - the same technique used in bilateral sharpening. This is a form of blurring that preserves edges and is useful for removing certain kinds of image noise.

By selecting the Precise Gaussian - Chroma Only option, you can reduce chroma noise in an image without making it significantly softer. Chroma noise is a sort of speckled color noise that most digital camera sensors produce, especially in high ISO images, in dark areas or in areas of very smoothly varying color and brightness.

Here are some examples:

     
                                     Original                                                                    Precise Gaussian              
                                                                                                           Radius 8.0, Threshold 100%

 
                          Precise Gaussian                                                Precise Gaussian - Chroma Only              
                   Radius 8.0, Threshold 5.9%                                           Radius 8.0, Threshold 5.9%

If you look closely at the area in the lower left corner of the image you can see that much of the chroma noise in the original is eliminated in the final image.

Varying the blur amount

In this example, the central region of the input image is kept sharp while blurring the rest with a gradual transition between the sharp and blurred areas. This is accomplished by creating a mask for the input image and then selecting it as the Radius Amount (see below) and selecting a fairly large radius. The radius amount mask was created using the Mask tool by roughly outlining the building using the Freehand Outline tool and then using the Mask Blur tool to soften the edges.

Other creative effects

In this example, the input image is blurred using a checkerboard mask for both the radius amount and the mask. The result is blurred only in the areas corresponding to the white squares and halos are suppressed.