You are here : matlabImage Processingordfilt2

ordfilt2() - Image Processing

B = ordfilt2(A,order,domain) replaces
each element in A by the orderth
element in the sorted set of neighbors specified by the nonzero elements
in domain. B = ordfilt2(A,order,domain,S) filters A,
where ordfilt2 uses the values of S corresponding
to the nonzero values of domain as additive offsets.
You can use this syntax to implement grayscale morphological operations,
including grayscale dilation and erosion.B = ordfilt2(___,padopt) filters A,
where padopt specifies how ordfilt2 pads
the matrix boundaries.Code Generation support:
Yes.MATLAB Function Block support:
Yes.


Syntax

B = ordfilt2(A,order,domain) exampleB = ordfilt2(A,order,domain,S)B = ordfilt2(___,padopt)


Example

Filter Image with Maximum FilterOpen This Example
Read image into workspace and display it.A = imread('snowflakes.png');
figure
imshow(A)

Filter the image and display the result.B = ordfilt2(A,25,true(5));
figure
imshow(B)


Output / Return Value


Limitations


Alternatives / See Also


Reference