divide gray scale image x0, y0, n, h, w = ... divided = [gray_image[x0*x:x0*(x+1), y0*y:y0*(y+1)] for x in range(n) for y in range(n)] # calculate entropy for each division entropies = [] for img in divided: img = np.array(img) e = calcEntropy_method(img) entropies.append(e) # visualize (omitted) ͋ʂ؈ͷඳ͖ࠐΈ͕ଟ͍ʂ ͳͲɺͩ͜ΘΓʹؾ͚Δ ඳ͖ࠐΈ͕ଟ͍ྖҬΛਪఆ͢ΔʢΤϯτϩϐʔͰܭࢉʣ PythonͰΠϥετ͔ΒృΓͷͩ͜ΘΓΛ୳Δ