The general histogram equalization formula for an 8-bit image is: h(v) = ((cdf(v) - cdf_min) / (M * N - cdf_min) * 255) where
cdf(v) is the cumulative distribution function. For each pixel v, cdf(v) equals to the number of pixels with values lower or equal to v cdf_min is the minimum non-zero value of the cumulative distribution function M × N are the sizes of the image
I want to calculate cdf(v) which I can do using iterating over all the pixels but I am wondering if there's a way to do it in an efficient way using numpy so that the whole operation is way faster.