class
Sharpen
extends
PhotometricTransform[TripletParams]Sharpen(alpha: tuple[float, float] = (0.2, 0.5), lightness: tuple[float, float] = (0.5, 1.0), p: float = 0.5)Sharpen an image via a 3x3 unsharp kernel blend (Albumentations Sharpen).
Convolves the image with a 3x3 Laplacian-of-Gaussian style kernel
whose centre weight is 8 + lightness, then blends the sharpened
result with the original using a per-call alpha. Higher
alpha puts more weight on the sharpened image; lightness
controls the centre-weight of the kernel and thus the strength of
the high-frequency boost.
Parameters
alpha(float, float)= (0.2, 0.5)Range from which the original / sharpened blend weight is
sampled uniformly per call.
lightness(float, float)= (0.5, 1.0)Range for the kernel-centre additive term
lightness; larger
values give a stronger sharpen.pfloat= 0.5Probability of applying the transform.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.Sharpen(alpha=(0.2, 0.5), lightness=(0.5, 1.0), p=1.0)
>>> out = tf(T.Image(lucid.rand(3, 32, 32))).data
>>> tuple(out.shape)
(3, 32, 32)Used by 1
Constructors
1Instance methods
1Sample per-call random parameters for Sharpen.
Parameters
imgTensorImage tensor; not inspected, carried through for dispatch.
Returns
TripletParamsCarries a (blend weight from alpha), b
(centre-weight additive term from lightness), and
c = 0.0 (unused — third slot kept for triplet
uniformity with sibling sharpen-family ops).