 ImageTools - Maple Programming Help

Home : Support : Online Help : Graphics : Image Processing : ImageTools Package : ImageTools/Entropy

ImageTools

 Entropy
 compute the entropy of the layers of an image

 Calling Sequence Entropy( img, N, opts )

Parameters

 img - Image; input image N - (optional) posint; number of buckets per layer opts - (optional) equation(s) of the form option = value; specify options for the Entropy command

Options

 • autorange = truefalse
 If true, set the range to the minimum and maximum values that occur in the image (on all layers).  Overrides the range option. The default is false.
 • range = numeric .. numeric
 Assigns the range of values that the buckets cover. The default is 0.0 .. 1.0, which corresponds to the the range of values in an unprocessed image.

Description

 • The Entropy command computes the entropy of each layer of an image.
 • The entropy, $H$, of a layer is computed by partitioning the intensities (values) of the pixels in the layer into $N$ buckets, and then computing $H=-\left({\sum }_{i=1}^{N}{P}_{i}{\mathrm{log}}_{2}\left({P}_{i}\right)\right)$, where ${P}_{i}$ is the probability that the intensity of a pixel falls in the $i$-th bucket.
 • The img parameter specifies the image for which the entropy of the layers is computed.
 • The optional N parameter specifies the number of buckets per layer. The default is 256, which is usually suitable for images read from 8-bit per pixel per layer image files.
 • For a single layer (grayscale) image, the Entropy command returns a single value. For 3 or 4 layer images, a list is returned; the i-th element in the list is the entropy of the i-th layer.

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img}≔\mathrm{Create}\left(100,200,\left(r,c\right)↦\mathrm{evalf}\left(\mathrm{sin}\left(\frac{\mathrm{\pi }\cdot r}{50}\right)\cdot \mathrm{exp}\left(-\frac{c}{50}\right)\right)\right):$
 > $\mathrm{Entropy}\left(\mathrm{img}\right)$
 ${4.17103135635641}$ (1)
 > $\mathrm{Entropy}\left(\mathrm{img},16\right);$$\mathrm{img}≔\mathrm{Create}\left(50,50,\left[\left(r,c\right)↦c\cdot r,\left(r,c\right)↦r+c,\left(r,c\right)↦\mathrm{evalf}\left(\mathrm{sin}\left(\frac{\mathrm{\pi }\cdot r}{25}\right)\right)\right],\mathrm{fit}\right):$
 ${1.65906192348188}$ (2)
 > $\mathrm{Entropy}\left(\mathrm{img}\right)$
 $\left[{7.36142010230650}{,}{6.36454035065060}{,}{4.64385618950637}\right]$ (3)