trim_extrema#
- trim_extrema(im, h, mode='maxima')[source]#
Trims local extrema in greyscale values by a specified amount.
This essentially decapitates peaks and/or floods valleys.
- Parameters:
im (ndarray) – The image whose extrema are to be removed
h (float) – The height to remove from each peak or fill in each valley
mode (string {'maxima' | 'minima' | 'extrema'}) – Specifies whether to remove maxima or minima or both
- Returns:
image – A copy of the input image with all the peaks and/or valleys removed.
- Return type:
ndarray
Notes
This function is referred to as imhmax or imhmin in Matlab.
(2) If the provided
h
is larger than ALL peaks in the array, then the baseline values of the array are changed as well.Examples
Click here to view online example.