Local entropy of grayscale image
J = entropyfilt(I)
J = entropyfilt(I,nhood)
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 real, nonsparse numeric array.
I can have any dimension. If
has more than two dimensions,
entropyfilt treats it as a
multidimensional grayscale image and not as a truecolor (RGB) image.
true(9)(default) | multidimensional, logical or numeric array containing zeros and ones
Neighborhood, specified as a multidimensional, logical or numeric array
containing zeros and ones. The size of
nhood must be odd
in each dimension.
entropyfilt uses the neighborhood
the center element of the neighborhood by
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
J— Filtered image
Filtered image, returned as a numeric array the same size as the input
image and of class
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.
 Gonzalez, R.C., R.E. Woods, S.L. Eddins, Digital Image Processing Using MATLAB, New Jersey, Prentice Hall, 2003, Chapter 11.