Skip to content

Unsharp Mask ​

Step: Finish

Makes fine detail stand out: edges get crisper, the structure in a galaxy's arms and the fine texture of a nebula become easier to see. The module blurs a copy of the image, takes the difference to the original, which is exactly the fine detail the blur wiped out, and adds a multiple of that difference back. The name comes from the darkroom technique of laying a deliberately blurred ("unsharp") copy over the picture to enhance its contrast at edges.

Parameters ​

ParameterRangeDefaultEffect
Radius0.3…20 pixels1.5Size of the blur, as the standard deviation of the Gaussian in pixels. It decides how large a structure counts as detail: a small radius sharpens the finest structures and star edges, a large one raises the contrast of broader structures such as dust lanes. The slider is logarithmic.
Amount0…30.8How much of the detail is added back. 0 leaves the image exactly as it is, 1 doubles the difference between a pixel and its blur, higher values sharpen harder.
Threshold0…0.10Differences smaller than this are not sharpened, so that noise is not lifted with the detail. In pixel values from 0 to 1 of the image. 0 sharpens every difference. See below.

When to use it ​

Sharpen last, after the stretch, and after Noise Reduction: sharpening makes every bit of noise stronger too, so the cleaner the image is, the further you can go. On the stretched image the faint structures you want to bring out are also at a brightness where you can judge them.

You can use it on linear data too, but with care. There the interesting structures are squeezed into a tiny range of values near black, so a sharpening of 0.8 hardly shows, and the same Threshold means very different things in the dark background and in the bright core of a galaxy.

  • Start with the defaults and look at the image at 100 %. Raise Amount until the detail is clear, but stop before the edges grow bright and dark fringes.
  • Use the Threshold to protect the background. Raise it until the sky background stays calm while stars and structures are still sharpened. A value just above the noise level of the background is a good start.
  • Use a small Radius (1 to 2 pixels) for stars and fine detail, a large one (5 to 20) to bring out the contrast of large structures without touching the fine grain.
  • The live preview works on a reduced copy of the image, in which the radius is scaled down too and the noise is already averaged away. Judge the final Radius and Threshold on the full-size result.

Threshold ​

The threshold works with a smooth transition, not a hard cut. Let d be the difference between a pixel and its blur and t the threshold:

  • If |d| is not above t, the pixel is not changed.
  • If |d| is at least twice t, the difference is added in full.
  • In between, the share that is added rises smoothly from nothing to everything, so no visible step appears where the noise crosses the threshold.

Noise is made of many small differences, edges and stars of few large ones, so a threshold just above the noise level sharpens the structures and leaves the grain alone. Structures whose contrast is lower than the threshold are not sharpened either.

How it works ​

  1. Blur. Every color channel is blurred on its own with a Gaussian of standard deviation Radius. The blur runs along the rows and then along the columns (the 2D Gaussian is the product of two 1D ones). The kernel reaches three times the radius to each side, rounded up, and its weights add up to 1. At the image border the image is mirrored.

  2. Difference. d = pixel − blurred pixel. It is positive on the bright side of an edge and in the center of a star, negative on the dark side and around it.

  3. Adding back. With g the gain from the threshold (0 to 1, see above):

    result = pixel + Amount · g · (pixel − blurred pixel)

    A flat area has no difference to its blur and stays as it is.

Overshoot and ringing. The sharpening makes the bright side of an edge brighter and the dark side darker. Next to a bright star this shows as a dark ring around it. This is the nature of the method. The result is not clamped: values may fall below 0 or rise above 1 until the display and the export cut them off. Keep Amount moderate and use the Threshold and a small Radius to keep the rings thin.

Pixels without data. Pixels without a value (for example the borders left by stacking) stay without a value. They are left out of the blur, so the edge of the data does not look like a bright or dark edge and is not sharpened.

The file information (exposure time, filter and so on) is kept.

Errors ​

  • The image is an undebayered mosaic; sharpening would exaggerate its color pattern. The pixels of the raw sensor mosaic differ in brightness from their neighbours because of the color filter, not because of detail. Run Debayer first.