Local standard deviation of image
J = stdfilt(I)
J = stdfilt(I, NHOOD)
gpuarrayJ = stdfilt(gpuarrayI,___)
J = stdfilt(I) returns the array J, where each output pixel contains the standard deviation of the 3-by-3 neighborhood around the corresponding pixel in the input image I. I can have any dimension. The output image J is the same size as the input image I.
For pixels on the borders of I, stdfilt uses symmetric padding. In symmetric padding, the values of padding pixels are a mirror reflection of the border pixels in I.
J = stdfilt(I, NHOOD) calculates the local standard deviation of the input image I, where you specify the neighborhood in NHOOD. NHOOD is a multidimensional array of zeros and ones where the nonzero elements specify the neighbors. NHOOD's size must be odd in each dimension. By default, stdfilt uses the neighborhood ones(3). stdfilt determines the center element of the neighborhood by floor((size(NHOOD) + 1)/2).
I can be logical or numeric and must be real and nonsparse. NHOOD can be logical or numeric and must contain zeros and/or ones. J is of class double.
The gpuArray gpuarrayI can be logical or numeric and must be real and nonsparse. The gpuArray returned gpuarrayJ is of class double.
To specify neighborhoods of various shapes, such as a disk, use the strel function to create a structuring element object and then use the getnhood method to extract the neighborhood from the structuring element object.
Perform standard deviation filtering.
I = imread('circuit.tif'); J = stdfilt(I); imshow(I); figure, imshow(J,);
Perform standard deviation filtering on a GPU.
I = gpuArray(imread('circuit.tif')); J = stdfilt(I); imshow(I); figure, imshow(J,);