{ } Raw JSON

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), optional

If None, a new array is allocated.

mask : ndarray of dtype (int or float), optional

Mask 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, optional

Offset added to the footprint center point. Shift is bounded to the footprint sizes (center must be inside the given footprint).

n_bins : int or None

The number of histogram bins. Defaults to image.max() + 1 if None is passed.

Returns

out : ndarray of shape (H, W, N) and dtype float

N is n_bins or image.max() + 1 if no value is passed to n_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 both footprint and mask, 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