Local entropy of grayscale image
For pixels on the borders of
entropyfilt uses symmetric padding. In symmetric padding, the
values of padding pixels are a mirror reflection of the border pixels in
This example shows how to perform entropy filtering using
entropyfilt. Brighter pixels in the filtered image correspond to neighborhoods in the original image with higher entropy.
Read an image into the workspace.
I = imread('circuit.tif');
Perform entropy filtering using
J = entropyfilt(I);
Show the original image and the processed image.
imshow(I) title('Original Image')
figure imshow(J,) title('Result of Entropy Filtering')
I— Image to be filtered
Image to be filtered, specified as a numeric array of any dimension. If
the input image has more than two dimensions
ndims(I)>2), such as for an RGB image, then
entropyfilt filters all 2-D planes along the higher
true(9)(default) | numeric array | logical array
Neighborhood, specified as a numeric or logical array containing
1s. The size of
nhood must be odd in each dimension.
entropyfilt uses the neighborhood
true(9). The center element of the neighborhood is
floor((size(nhood) + 1)/2).
To specify neighborhoods of other shapes, such as a disk, use the
strel function to create a
structuring element object of the desired shape. Then, extract the
neighborhood from the structuring element object’s
entropyfilt uses two bins for logical arrays.
entropyfilt converts any other class to
uint8 for the histogram count calculation and uses 256
bins so that the pixel values are discrete and directly correspond to a bin
 Gonzalez, R. C., R. E. Woods, and S. L. Eddins. Digital Image Processing Using MATLAB. New Jersey, Prentice Hall, 2003, Chapter 11.