{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / exposure / exposure / histogram

function

skimage.exposure.exposure:histogram

source: /dev/scikit-image/src/skimage/exposure/exposure.py :190

Signature

def   histogram ( image nbins = 256 source_range = image normalize = False * channel_axis = None )

Summary

Return histogram of image.

Extended Summary

Unlike numpy.histogram, this function returns the centers of bins and does not rebin integer arrays. For integer arrays, each integer value has its own bin, which improves speed and intensity-resolution.

If channel_axis is not set, the histogram is computed on the flattened image. For color or multichannel images, set channel_axis to use a common binning for all channels. Alternatively, one may apply the function separately on each channel to obtain a histogram for each color channel with separate binning.

Parameters

image : array

Input image.

nbins : int, optional

Number of bins used to calculate histogram. This value is ignored for integer arrays.

source_range : {'image', 'dtype'}, optional

'image' (default) determines the range from the input image. 'dtype' determines the range from the expected range of the images of that data type.

normalize : bool, optional

If True, normalize the histogram by the sum of its values.

channel_axis : int or None, optional

If None, the image is assumed to be a grayscale (single channel) image. Otherwise, this parameter indicates which axis of the array corresponds to channels.

Returns

hist : array

The values of the histogram. When channel_axis is not None, hist will be a 2D array where the first axis corresponds to channels.

bin_centers : array

The values at the center of the bins.

Examples

from skimage import data, exposure, img_as_float
image = img_as_float(data.camera())
np.histogram(image, bins=2)
exposure.histogram(image, nbins=2)

See also

cumulative_distribution

Aliases

  • skimage.exposure.histogram

Referenced by