Cumulative Histogram


I had previously written about Image Histogram here:

A cumulative histogram sums the number of pixels having the current value or smaller than the current value.

The following function computes the cumulative histogram

def cumulativeHistogram(hist):

"""The function takes as input a histogram [np.array] and returns the cumulative histogram [np.array]"""

cum_hist = np.zeros((256,1))

for i in range(256):

cum_hist[i] = sum(hist[:i+1])

return cum_hist



Talha Hanif Butt

PhD Student -- Signal and Systems Engineering, Halmstad University, Volvo Trucks