Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

stdfilt

Local standard deviation of image

Syntax

J = stdfilt(I)
J = stdfilt(I,nhood)
gpuarrayJ = stdfilt(gpuarrayI,___)

Description

example

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.

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.

To specify neighborhoods of various shapes, such as a disk, use the strel function to create a structuring element object and then extract the neighborhood from the structuring element object’s neighborhood property.

example

gpuarrayJ = stdfilt(gpuarrayI,___) performs the conversion on a GPU. The input image and the output image are gpuArrays. This syntax requires the Parallel Computing Toolbox™.

Examples

collapse all

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 stdfilt.

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')

Read images into gpuArrays.

I = gpuArray(imread('circuit.tif'));

Perform standard deviation filtering using stdfilt.

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')

Input Arguments

collapse all

Image to be filtered, specified as a real, nonsparse, logical or numeric array of any dimension.

Example:

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Neighborhood, specified as a multidimensional, logical or numeric array containing zeros and ones. NHOOD's size must be odd in each dimension.

By default, stdfilt uses the neighborhood true(3). stdfilt determines the center element of the neighborhood by 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 neighborhood property.

Example:

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Image to be filtered on a GPU, specified as a gpuArray.

Example:

Output Arguments

collapse all

Filtered image, returned as a numeric array the same size as the input image I of class double.

Algorithms

If the image contains Infs or NaNs, the behavior of stdfilt is undefined. Propagation of Infs or NaNs might not be localized to the neighborhood around the Inf or NaN pixel.

See Also

Functions

Using Objects

Introduced before R2006a

Was this topic helpful?