bundles / skimage latest / skimage / filters / rank / generic / modal
function
skimage.filters.rank.generic:modal
source: /dev/scikit-image/src/skimage/filters/rank/generic.py :1055
Signature
def modal ( image , footprint , out = None , mask = None , shift_x = 0 , shift_y = 0 , shift_z = 0 ) Summary
Return local mode of an image.
Extended Summary
The mode is the value that appears most often in the local histogram.
Parameters
image: ndarray of shape ([P,] M, N) and dtype (uint8 or uint16)Input image.
footprint: ndarrayThe neighborhood expressed as an ndarray of 1's and 0's.
out: ndarray of shape ([P,] M, N), same dtype as input `image`If None, a new array is allocated.
mask: ndarray of dtype (int or float), optionalMask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
shift_x, shift_y, shift_z: intOffset added to the footprint center point. Shift is bounded to the footprint sizes (center must be inside the given footprint).
Returns
out: ([P,] M, N) ndarray, same dtype as `image`Output image.
Examples
from skimage import data from skimage.morphology import disk, ball from skimage.filters.rank import modal import numpy as np img = data.camera() rng = np.random.default_rng() volume = rng.integers(0, 255, size=(10,10,10), dtype=np.uint8) out = modal(img, disk(5)) out_vol = modal(volume, ball(5))✓
Aliases
-
skimage.filters.rank.modal