Skip to content

nabu.processing.unsharp

source module nabu.processing.unsharp

Classes

source class UnsharpMask(shape, sigma, coeff, mode='reflect', method='gaussian')

A helper class for unsharp masking.

Initialize a Unsharp mask. UnsharpedImage = (1 + coeff)*Image - coeff * ConvolutedImage

If method == "log": UnsharpedImage = Image + coeff*ConvolutedImage

Parameters

  • shape : tuple Shape of the image.

  • sigma : float Standard deviation of the Gaussian kernel

  • coeff : float Coefficient in the linear combination of unsharp mask

  • mode : str, optional Convolution mode. Default is "reflect"

  • method : str, optional Method of unsharp mask. Can be "gaussian" (default) or "log" (Laplacian of Gaussian), or "imagej".

Notes

The computation is the following depending on the method:

  • For method="gaussian": output = (1 + coeff) * image - coeff * image_blurred
  • For method="log": output = image + coeff * image_blurred
  • For method="imagej": output = (image - coeff*image_blurred)/(1-coeff)

Methods

  • unsharp Reference unsharp mask implementation.

source method UnsharpMask.unsharp(image, output=None)

Reference unsharp mask implementation.