class
CLAHE
extends
_NoParamsPhotometricTransform[Empty]CLAHE(clip_limit: float = 4.0, tile_grid_size: tuple[int, int] = (8, 8), p: float = 0.5)Contrast-limited adaptive histogram equalization (Albumentations CLAHE).
Thin wrapper around functional.clahe: per-tile
clipped-histogram LUT + 4-neighbour bilinear interpolation between
tile centres. Single-channel images are equalized directly; RGB
is routed through the HSV value channel so hue and saturation are
preserved (mirrors Albumentations' "luminance-only" behaviour).
Parameters
clip_limitfloat= 4.0Contrast-clip threshold; per-tile histogram cap is
clip_limit * tile_area / 256. Higher values allow more
contrast amplification at the cost of noise.tile_grid_size(int, int)= (8, 8)Number of tiles
(rows, cols) the image is divided into.
Larger grids give more local adaptivity at a per-tile cost.pfloat= 0.5Probability of applying the transform.
Notes
Approximate cv2 / Albumentations parity (colour-space pivot
differs: HSV value vs LAB L). Currently ~30× slower than Albu
on a 224² RGB input — see functional.clahe notes for the
bottleneck description.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.CLAHE(clip_limit=4.0, tile_grid_size=(8, 8), p=1.0)
>>> out = tf(T.Image(lucid.rand(3, 64, 64))).data
>>> tuple(out.shape)
(3, 64, 64)