educelab.imgproc.enhance

educelab.imgproc.enhance.clahe(image, kernel_size=None, clip_limit=0.01, nbins=256)

Contrast limited adaptive histogram equalization (CLAHE).

See: skimage.exposure.equalize_adapthist()

educelab.imgproc.enhance.clip(a, a_min=<no value>, a_max=<no value>, out=None, *, min=<no value>, max=<no value>, **kwargs)

Clip image values to a range.

educelab.imgproc.enhance.curves(image, x, y=None, **kwargs)

Cubic spline curves enhancement, aka Photoshop Curves.

Constructs and applies a cubic spline intensity transfer function to the input image.

Parameters:
  • image – Input image

  • x – If shape (n,), the spline knot positions in the input intensity domain (a.k.a. the independent variables). If shape (n, 2), then a list of pairs defining the spline knot positions in both the input and output domains.

  • y – If provided, an array_like of shape (n,) corresponding to spline knot positions in the output intensity range (a.k.a. the dependent variables). Required if x has shape (n,).

  • kwargs – Extra kwargs passed to scipy.interpolate.CubicSpline().

Returns:

The enhanced image.

educelab.imgproc.enhance.stretch(image, a_min, a_max, **kwargs)

Linearly rescale the provided min/max range to the dynamic range of the image.

educelab.imgproc.enhance.stretch_binned_percentile(image, percent: float | Sequence[float, float, ...] | None = None, bins=256, **kwargs)

Alternative version of stretch_percentile() that uses percentiles calculated from intensity binning.

educelab.imgproc.enhance.stretch_percentile(image, min_perc, max_perc, **kwargs)

Linearly rescale the provided percentile range to the dynamic range of the image.