Digital image equalization is the pixel value transformation that renders the value histogram constant.
It is simpler to work with the cumulant function. C[i] is the sum of the histogram values from 0 to i (for the practical case of gray level images). A constant histogram is equivalent to a uniformly increasing cumulant function.
If the given image has cumulant C[i], in order to equalize it it is enough to change its pixel values according to
In fact the cumulant of the transformed image is C'[i'] = C[i] = i' N/256.