Sharpen the image via a 3x3 kernel or a Gaussian unsharp mask, with strength
controlled by alpha_range and lightness_range.
Implements two different approaches to image sharpening:
alpha_rangeRange for the visibility of sharpening effect. At 0, only the original image is visible, at 1.0 only its processed version is visible. Values should be in the range [0, 1]. Used in both methods. Default: (0.2, 0.5).
lightness_rangeRange for the lightness of the sharpened image. Only used in 'kernel' method. Larger values create higher contrast. Values should be greater than 0. Default: (0.5, 1.0).
methodSharpening algorithm to use:
kernel_sizeSize of the Gaussian blur kernel for 'gaussian' method. Must be odd. Default: 5
sigmaStandard deviation for Gaussian kernel in 'gaussian' method. Default: 1.0
pProbability of applying the transform. Default: 0.5.
>>> import albumentations as A
>>> import numpy as np
# Traditional kernel sharpening
>>> transform = A.Sharpen(
... alpha_range=(0.2, 0.5),
... lightness_range=(0.5, 1.0),
... method='kernel',
... p=1.0
... )
# Gaussian interpolation sharpening
>>> transform = A.Sharpen(
... alpha_range=(0.5, 1.0),
... method='gaussian',
... kernel_size=5,
... sigma=1.0,
... p=1.0
... )