Sharpening by taking away a blurred copy of the image
Unsharp Mask is the classic sharpening: a blurred copy of the image is taken away from it, which steepens the edges of the structures about the size of the blur. With deringing to take back the halos it leaves around stars, and room in the dynamic range for what it brightens, it is a quick way to give a finished image more bite.
The name comes from the darkroom: a blurred, "unsharp" copy of a negative was used as a mask to print a sharper image. Digitally, the image f and its Gaussian blur b are combined as (a f − (1 − a) b) / (2a − 1), with a set by the amount: the structures about the size of the blur are amplified, the large ones are kept, and the image's brightness does not change.
The standard deviation of the blur chooses the size of what is sharpened: 1 to 2 pixels for the finest details, more for larger structures. The amount chooses how strongly. Like every sharpening, it overshoots at sharp edges: a dark ring around a bright star, a bright one along a dark lane. Deringing takes them back, and the dynamic range gives the brightened and darkened values room instead of clipping them.
By default it sharpens the lightness, CIE L*, so the colors are not sharpened into noise; a linear image is sharpened on its luminance, CIE Y.
Unsharp Mask is our own engine, with the parameters of PixInsight's UnsharpMask: a PixInsight icon of it opens here, and the panel saves one that PixInsight opens.
The panel has four sections, Filter, Target, Deringing and Dynamic range, each of which folds away with the arrow beside its title. Under them are the image the process applies to with the live preview's eye, the buttons and the system bar along the bottom.
StdDev: The standard deviation, in pixels, of the Gaussian that blurs the mask: the size of the structures sharpened. From 0.1 to 250; 2 by default.
Amount: How strongly, from 0.1 to 1: the blurred copy's weight. 0.8 by default.
Luminance only: On by default. A color image's lightness, CIE L*, is sharpened, or its luminance, CIE Y, when Linear is on; off, each channel is sharpened.
Linear: Off by default. The image is linear: sharpen its luminance, CIE Y, instead of its lightness. Only with Luminance only.
Deringing: Off by default. Takes back the dark and bright rings the sharpening leaves around stars and edges.
Dark: How much of the dark rings is taken back, from 0 to 1; 0.1 by default.
Bright: How much of the bright rings is taken back, from 0 to 1; 0 by default.
Low range: Room below 0 for what the sharpening darkens, from 0 to 1: the result is rescaled into the range from 0 to 1 instead of clipped. 0 by default.
High range: Room above 1 for what the sharpening brightens, from 0 to 1, the same way. 0 by default.
Live preview (the eye): At the end of the Applies to row; Preview in the system bar is the same switch. On by default. The image shows Unsharp Mask applied to the part in view, as the settings change, with the banner "PREVIEW only, nothing applied"; the image itself does not change until Apply. Before, in the banner, or the backslash key held, shows the image as it is. At 1:1 the preview is what Apply gives there. At a reduced zoom the standard deviation is scaled with the view, so the preview sharpens the same structures; it is close to Apply, not the same. Judge a sharpening at 1:1.
Applies to: The image Unsharp Mask works on, chosen in a list of the open images. It shows the image in front, and follows it as we bring other images to the front. Picking another image in the list makes the panel work on that one, its live preview included, without bringing it to the front; the pick stays while we work on other images, and Follow Active, the small button that appears beside the list, makes the panel follow the image in front again. An image that a tool or a run is working on is listed, but cannot be picked.
Apply: Sharpens the image named in Applies to, in one history step that Undo takes back, through the image's mask if it has one. The size, the sample format, the metadata and the astrometric solution stay as they are.
Instance: Shows the process as the panel has it now, as text: the settings as a DSPX
process (.dsproc) or as a PixInsight process icon (.xpsm) of UnsharpMask, chosen under
Format. Copy puts the text on the clipboard; Save... saves it as a file and puts it on the Process
Shelf.
Reset: Puts every setting back to its default.
The system bar along the bottom of the panel has the same commands as small icons: at the left, drag to apply and Apply; at the right, Instance, Help (this page) and Reset. Drag to apply, the first icon, carries the process with its settings: dropped on an image's window, it applies them to that image, whatever image the panel works on; dropped on the Process Shelf, it is kept there as a row of its own. With , the bar alone has them.
Deringing compares the sharpened image with the original, pixel by pixel, as a ratio. Where the ratio falls below its median, the sharpening darkened the pixel more than usual, a dark ring, and Dark brings it back up; where it rises above, a bright ring, and Bright brings it down. The median is that of the whole image, so a preview at 1:1 gives the same deringing as Apply.
The dynamic range keeps the overshoot instead of clipping it: the result is first allowed down to minus the low range and up to 1 plus the high range, then, when anything is outside the range from 0 to 1, rescaled into it from the extremes of the whole image. A little high range keeps the cores of sharpened stars from turning flat white.
Unsharp Mask follows the published formula of the unsharp mask and PixInsight's documented parameters and deringing scheme. Results are close to PixInsight's in kind, not the same, in either of DSPX's modes. The deringing maps PixInsight can write are not done yet: an icon keeps the setting.
Through a mask. Sharpening also sharpens the noise. Apply it through a Range Mask of the object, so the sky is left alone.
Small and gentle. A standard deviation of 1 to 2 pixels and an amount of 0.5 to 0.7 is usually enough for a finished image; larger values make halos that deringing cannot hide.
Stars first. On a starless image there is nothing to ring: sharpen the starless image and put the stars back afterward.
GPU. In DSPX mode the Gaussian blur and the sharpening of each plane run on the graphics card when the image is a quarter of a megapixel or more. The work is small for the card, which must also receive and return every plane, so the gain is modest: a 24 MP color image with the RGB/K target runs about 1.7 times faster, and with the Lightness or Luminance target (the default) the conversion of the colors runs on the card too and the run is about six times faster. The deringing and the dynamic range extension run on the processor, and take most of the time when they are on. The result agrees with the processor's to a few millionths of the range. Choose CPU only in to keep it on the processor, and see The Processor and the GPU.
Multiscale Sharpen: a gain at each scale instead of one.
Deconvolution: restores the detail the optics and the seeing blurred, from the measured stars.
Clarity: local contrast that cannot ring.
Blur: the opposite, and a way to build an unsharp mask of our own with Pixel Math.