contrast_enhancer¶
tiatoolbox
.utils
.misc
.contrast_enhancer
- contrast_enhancer(img, low_p=2, high_p=98)[source]¶
Enhance contrast of the input image using intensity adjustment.
This method uses both image low and high percentiles.
- Parameters:
img (
numpy.ndarray
) – input image used to obtain tissue mask. Image should be uint8.low_p (scalar) – low percentile of image values to be saturated to 0.
high_p (scalar) – high percentile of image values to be saturated to 255. high_p should always be greater than low_p.
- Returns:
Image (uint8) with contrast enhanced.
- Return type:
img (
numpy.ndarray
)- Raises:
AssertionError – Internal errors due to invalid img type.
Examples
>>> from tiatoolbox import utils >>> img = utils.misc.contrast_enhancer(img, low_p=2, high_p=98)