From 62d3b5590b0e5d45d1128bc60daa1a9eb39ee1eb Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Thu, 22 Dec 2011 10:58:02 -0800 Subject: [PATCH] Remove `density` parameter in `histogram` The `density` (or `normed`) parameter was set in the original implementation of `equalize`, but it is unnecessary since `cumulative_distribution` renormalizes values. The only other function in scikits-image that calls `histogram` (`filter.threshold_otsu`) is not affected by renormalization. --- skimage/exposure/exposure.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/skimage/exposure/exposure.py b/skimage/exposure/exposure.py index ca16c975..d120b386 100644 --- a/skimage/exposure/exposure.py +++ b/skimage/exposure/exposure.py @@ -6,7 +6,7 @@ import skimage __all__ = ['histogram', 'cumulative_distribution', 'equalize'] -def histogram(image, nbins, density=True): +def histogram(image, nbins=256): """Return histogram of image. Unlike `numpy.histogram`, this function returns the centers of bins and @@ -20,10 +20,6 @@ def histogram(image, nbins, density=True): nbins : int Number of bins used to calculate histogram. This value is ignored for integer arrays. - density : {True | False} - If True, values represent the probability density function. - If False, values represent the number of pixels in bins. - See numpy.histogram for details. Returns ------- @@ -43,12 +39,7 @@ def histogram(image, nbins, density=True): idx = np.nonzero(hist)[0][0] return hist[idx:], bin_centers[idx:] else: - - if np.version.version >= '1.6': - hist, bin_edges = np.histogram(image.flat, nbins, density=density) - else: - hist, bin_edges = np.histogram(image.flat, nbins, normed=density) - + hist, bin_edges = np.histogram(image.flat, nbins) bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2. return hist, bin_centers