The toolbox includes several texture analysis functions that filter an image using standard statistical measures. These statistics can characterize the texture of an image because they provide information about the local variability of the intensity values of pixels in an image. For example, in areas with smooth texture, the range of values in the neighborhood around a pixel is a small value; in areas of rough texture, the range is larger. Similarly, calculating the standard deviation of pixels in a neighborhood can indicate the degree of variability of pixel values in that region. The table lists these functions.
Function | Description |
---|---|
rangefilt | Calculates the local range of pixel intensities of an image. |
stdfilt | Calculates the local standard deviation of an image. |
entropyfilt | Calculates the local entropy of a grayscale image. Entropy is a statistical measure of randomness. |
The functions all operate in a similar way: they define a neighborhood around the pixel of interest, calculate the statistic for that neighborhood, and use that value as the value of the pixel of interest in the output image.
This example shows how the rangefilt
function operates on a simple
array.
A = [ 1 2 3 4 5; 6 7 8 9 10; 11 12 13 14 15; 16 17 18 19 20 ] A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 B = rangefilt(A) B = 6 7 7 7 6 11 12 12 12 11 11 12 12 12 11 6 7 7 7 6
The following figure shows how the value of element B(2,4)
was
calculated from A(2,4)
. By default, the rangefilt
function uses a 3-by-3 neighborhood but you can specify neighborhoods of different
shapes and sizes.
Determining Pixel Values in Range Filtered Output Image
The stdfilt
and entropyfilt
functions operate
similarly, defining a neighborhood around the pixel of interest and calculating the
statistic for the neighborhood to determine the pixel value in the output image. The
stdfilt
function calculates the standard deviation of all the
values in the neighborhood.
The entropyfilt
function calculates the entropy of the neighborhood
and assigns that value to the output pixel. By default, the
entropyfilt
function defines a 9-by-9 neighborhood around the
pixel of interest. To calculate the entropy of an entire image, use the
entropy
function.
entropyfilt
| rangefilt
| stdfilt