histogram

histogram

skimage.exposure.histogram(image, nbins=256) [source]

Return histogram of image.

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.

The histogram is computed on the flattened image: for color images, the function should be used separately on each channel to obtain a histogram for each color channel.

Parameters:

image : array

Input image.

nbins : int

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

Returns:

hist : array

The values of the histogram.

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)
(array([107432, 154712]), array([ 0. ,  0.5,  1. ]))
>>> exposure.histogram(image, nbins=2)
(array([107432, 154712]), array([ 0.25,  0.75]))
doc_scikit_image
2017-01-12 17:21:13
Comments
Leave a Comment

Please login to continue.