bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / filters / rank / generic / windowed_histogram
function
skimage.filters.rank.generic:windowed_histogram
source: /dev/scikit-image/src/skimage/filters/rank/generic.py :1623
Signature
def windowed_histogram ( image , footprint , out = None , mask = None , shift_x = 0 , shift_y = 0 , n_bins = None ) Summary
Compute normalized sliding window histogram.
Parameters
image: ndarray of shape (H, W) and dtype (int or float)Input image.
footprint: ndarray of dtype (int or float)The neighborhood expressed as a 2-D array of 1's and 0's.
out: ndarray of shape (H, W, N) and dtype (int or float), optionalIf 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: int, optionalOffset added to the footprint center point. Shift is bounded to the footprint sizes (center must be inside the given footprint).
n_bins: int or NoneThe number of histogram bins. Defaults to
image.max() + 1if None is passed.
Returns
out: ndarray of shape (H, W, N) and dtype floatNisn_binsorimage.max() + 1if no value is passed ton_bins. Effectively, each pixel is a N-D feature vector that is the histogram. The sum of the elements in the feature vector is 1, unless no pixels in the window were covered by bothfootprintandmask, in which case all elements are 0.
Examples
from skimage import data from skimage.filters.rank import windowed_histogram from skimage.morphology import disk, ball import numpy as np img = data.camera() rng = np.random.default_rng() volume = rng.integers(0, 255, size=(10,10,10), dtype=np.uint8) hist_img = windowed_histogram(img, disk(5))✓
Aliases
-
skimage.filters.rank.windowed_histogram