Local entropy of grayscale image

`J = entropyfilt(I)`

J = entropyfilt(I,NHOOD)

`J = entropyfilt(I)`

returns
the array `J`

, where each output pixel contains the
entropy value of the 9-by-9 neighborhood around the corresponding
pixel in the input image `I`

. `I`

can
have any dimension. If `I`

has more than two dimensions,
`entropyfilt`

treats it as a multidimensional grayscale
image and not as a truecolor (RGB) image. The output image `J`

is
the same size as the input image `I`

.

For pixels on the borders of `I`

, `entropyfilt`

uses
symmetric padding. In symmetric padding, the values of padding pixels
are a mirror reflection of the border pixels in `I`

.

`J = entropyfilt(I,NHOOD)`

performs
entropy filtering of the input image `I`

where you
specify the neighborhood in `NHOOD`

. `NHOOD`

is
a multidimensional array of zeros and ones where the nonzero elements
specify the neighbors. `NHOOD`

'`s`

size
must be odd in each dimension.

By default, `entropyfilt`

uses the neighborhood `true(9)`

. `entropyfilt`

determines
the center element of the neighborhood by ```
floor((size(NHOOD)
+ 1)/2)
```

. To specify neighborhoods of various shapes, such
as a disk, use the `strel`

function to create a structuring
element object and then use the `getnhood`

function
to extract the neighborhood from the structuring element object.

`I`

can be `logical`

, `uint8`

, `uint16`

,
or `double`

, and must be real and nonsparse. `NHOOD`

can
be logical or numeric and must contain zeros or ones. The output array `J`

is
of class `double`

.

`entropyfilt`

converts any class other than
logical to `uint8`

for the histogram count calculation
so that the pixel values are discrete and directly correspond to a
bin value.

I = imread('circuit.tif'); J = entropyfilt(I); imshow(I), figure, imshow(J,[]);

[1] Gonzalez, R.C., R.E. Woods, S.L. Eddins, *Digital
Image Processing Using MATLAB*, New Jersey, Prentice Hall,
2003, Chapter 11.

Was this topic helpful?