EntropyΒΆ

Image entropy is a quantity which is used to describe the amount of information coded in an image.

../_images/plot_entropy_1.png

import matplotlib.pyplot as plt

from skimage import data
from skimage.filter.rank import entropy
from skimage.morphology import disk
from skimage.util import img_as_ubyte


image = img_as_ubyte(data.camera())

fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(10, 4))

img0 = ax0.imshow(image, cmap=plt.cm.gray)
ax0.set_title('Image')
ax0.axis('off')
fig.colorbar(img0, ax=ax0)

img1 = ax1.imshow(entropy(image, disk(5)), cmap=plt.cm.jet)
ax1.set_title('Entropy')
ax1.axis('off')
fig.colorbar(img1, ax=ax1)

plt.show()

STDOUT


        

STDERR


        

Python source code: download (generated using skimage 0.11dev)

IPython Notebook: download (generated using skimage 0.11dev)

aW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdAoKZnJvbSBza2ltYWdlIGltcG9ydCBkYXRhCmZyb20gc2tpbWFnZS5maWx0ZXIucmFuayBpbXBvcnQgZW50cm9weQpmcm9tIHNraW1hZ2UubW9ycGhvbG9neSBpbXBvcnQgZGlzawpmcm9tIHNraW1hZ2UudXRpbCBpbXBvcnQgaW1nX2FzX3VieXRlCgoKaW1hZ2UgPSBpbWdfYXNfdWJ5dGUoZGF0YS5jYW1lcmEoKSkKCmZpZywgKGF4MCwgYXgxKSA9IHBsdC5zdWJwbG90cyhuY29scz0yLCBmaWdzaXplPSgxMCwgNCkpCgppbWcwID0gYXgwLmltc2hvdyhpbWFnZSwgY21hcD1wbHQuY20uZ3JheSkKYXgwLnNldF90aXRsZSgnSW1hZ2UnKQpheDAuYXhpcygnb2ZmJykKZmlnLmNvbG9yYmFyKGltZzAsIGF4PWF4MCkKCmltZzEgPSBheDEuaW1zaG93KGVudHJvcHkoaW1hZ2UsIGRpc2soNSkpLCBjbWFwPXBsdC5jbS5qZXQpCmF4MS5zZXRfdGl0bGUoJ0VudHJvcHknKQpheDEuYXhpcygnb2ZmJykKZmlnLmNvbG9yYmFyKGltZzEsIGF4PWF4MSkKCnBsdC5zaG93KCk=