xlandsat.equalize_histogram(composite, kernel_size=None, clip_limit=0.01)[source]#

Adaptive histogram equalization for a composite

Use this function to enhance the contrast of a composite when there are a few very dark or very light patches that dominate the color range. Use this instead of rescaling intensity (contrast stretching) to try to preserve some detail in the light/dark patches.

If the composite has an alpha channel (transparency), it will be copied to the output intact.


Results can be very bad if there are missing values (NaNs) in the composite. Use xlandsat.interpolate_missing on the scene first (before creating the composite) if that is the case.


equalized_composite (xarray.DataArray) – The composite after equalization, scaled back to unsigned 8-bit integer range.


This function first converts the composite from the RGB color space to the HSV color space. Then, it applies skimage.exposure.equalize_adapthist to the values (intensity) channel. Finally, the composite is converted back into the RGB color space.