def map_histogram(hist, min_val, max_val, n_pixels):
 out = np.cumsum(hist).astype(float)
 scale = (float((max_val - min_val)) / n_pixels)
 out *= scale
 out += min_val
 out[(out > max_val)] = max_val
 return out.astype(int)

def map_histogram ( hist , min_val , max_val , n_pixels ) : out = np . cumsum ( hist ) . astype ( float ) scale = ( float ( ( max_val - min_val ) ) / n_pixels ) out *= scale out += min_val out [ ( out > max_val ) ] = max_val return out . astype ( int )
calculate the equalized lookup table .