Local standard deviation of image
performs standard deviation filtering of image
J = stdfilt(
I and returns
the filtered image
J. The value of each output pixel is the
standard deviation of the 3-by-3 neighborhood around the corresponding input pixel.
For pixels on the borders of
symmetric padding. In symmetric padding, the values of padding pixels are a mirror
reflection of the border pixels in
Perform Standard Deviation Filtering
This example shows how to perform standard deviation filtering using
stdfilt. Brighter pixels in the filtered image correspond to neighborhoods in the original image with larger standard deviations.
Read an image into the workspace.
I = imread('circuit.tif');
Perform standard deviation filtering using
J = stdfilt(I);
Show the original image and the processed image.
imshow(I) title('Original Image')
figure imshow(J,) title('Result of Standard Deviation Filtering')
I — Image to be filtered
numeric array | logical array
Image to be filtered, specified as a numeric array or logical array of any dimension.
nhood — Neighborhood
true(3) (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.
stdfilt uses the neighborhood
stdfilt determines the
center element of the neighborhood by
To specify neighborhoods of various 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
neighborhood property of the
If the image contains
NaNs, then the
stdfilt is undefined. Propagation of
NaNs might not be localized to the
neighborhood around the
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
The filtering neighborhood must be two-dimensional.
For more information, see Image Processing on a GPU.