Image Processing Toolbox User's Guide Previous page   Next Page
nlfilter

Perform general sliding-neighborhood operations

Syntax

Description

B = nlfilter(A,[m n],fun) applies the function fun to each m-by-n sliding block of A. fun is a function that accepts an m-by-n matrix as input and returns a scalar result.

fun must be a function handle.

c is the output value for the center pixel in the m-by-n block x. nlfilter calls fun for each pixel in A. nlfilter zero-pads the m-by-n block at the edges, if necessary.

B = nlfilter(A,'indexed',...) processes A as an indexed image, padding with 1's if A is of class double and 0's if A is of class uint8.

Class Support

The input image A can be of any class supported by fun. The class of B depends on the class of the output from fun.

Remarks

nlfilter can take a long time to process large images. In some cases, the colfilt function can perform the same operation much faster.

Example

This example produces the same result as calling medfilt2 with a 3-by-3 neighborhood.

See Also

blkproc, colfilt, function_handle


Previous page  montage normxcorr2 Next page

© 1994-2005 The MathWorks, Inc.