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
Perform Entropy Filtering
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 (
2), such as for an RGB image, then
entropyfilt filters all 2-D planes along the higher
dimensions. For data types
single, the intensity values of
I must be in the range [0, 1].
nhood — Neighborhood
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
J — Filtered image
Filtered image, returned as a numeric array the same size as the input
I. The data type of
double. If the input image
a binary image (data type
logical), then the values of
J are in the range [0, 1]. For all other data types
I, the values of
J are in the
range [0, 8].
entropyfiltuses two bins for logical arrays.
entropyfiltconverts any other class to
uint8for the histogram count calculation and uses 256 bins so that the pixel values are discrete and directly correspond to a bin value.
If the input image
Iis a grayscale image, then the values of
Jcan exceed the range [0, 1] that some Image Processing Toolbox™ functions expect for images of type
double. To pass
Jas an input argument to these functions, use the
rescalefunction to rescale the values of
Jto the range [0, 1].
 Gonzalez, R. C., R. E. Woods, and S. L. Eddins. Digital Image Processing Using MATLAB. New Jersey, Prentice Hall, 2003, Chapter 11.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version HistoryIntroduced before R2006a
R2022b: Support for thread-based environments
entropyfilt now supports thread-based