I am wondering is it possible to divide image into blocks for example 8x8 blocks (64 pixels per block
) and perform histogram function for each block and save results into a new image not to separately images?
def apply_histogram(block):
h, b = np.histogram(block.flatten(), 256, normed=True)
cdf = h.cumsum()
cdf = 255 * cdf / cdf[-1]
return np.interp(block.flatten(), b[:-1], cdf).reshape(block.shape)