From 3f47aefa908ab88d60e95b6d4c4c67f93a5f7002 Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Sat, 20 Apr 2013 19:53:58 +0200 Subject: [PATCH] histogram example --- skimage/exposure/exposure.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/skimage/exposure/exposure.py b/skimage/exposure/exposure.py index c7f1e712..10d2427d 100644 --- a/skimage/exposure/exposure.py +++ b/skimage/exposure/exposure.py @@ -14,6 +14,7 @@ __all__ = ['histogram', 'cumulative_distribution', 'equalize', def histogram(image, nbins=256): """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. @@ -32,6 +33,14 @@ def histogram(image, nbins=256): The values of the histogram. bin_centers : array The values at the center of the bins. + + Examples + -------- + >>> camera = skimage.data.camera() + >>> hi = exposure.histogram(camera) + >>> # Plot histogram + >>> import matplotlib.pyplot as plt + >>> plt.plot(hi[1], hi[0]) """ # For integer types, histogramming with bincount is more efficient.