components.photo.unsharpmask

class UnsharpMask(config={}, **kwds)[source]

Bases: pyctools.core.base.Transformer

Enhance image detail using an unsharp mask.

The unsharp mask is computed by subtracting a Gaussian blurred image from the original image. Low amplitude detail can be removed before the mask is added back to the image to sharpen it. This can reduce the increase in noise when lots of sharpening is applied.

The amount parameter specifies how much sharpening to apply. It is a real number rather than the percentage used in some software. The radius parameter sets the standard deviation of the Gaussian blurring filter.

To avoid discontinuities in the mask the threshold is used in a “coring” function. Detail lower than the threshold is ignored, detail above the threshold is reduced by the threshold value.

Another option to reduce noise is denoise. This uses a 5x5 median filter as part of the mask computation.

Note that this component can also be used to soften an image using a Gausssian filter. Set amount = -1, threshold = 0, and denoise = False.

Config

amount

float

Amount of sharpening to apply.

radius

float

Size of blurring function.

threshold

float

Don’t sharpen low amplitude detail.

denoise

bool

Median filter the detail to suppress noise.


Comments or questions? Please email jim@jim-easterbrook.me.uk.