Image Processing Toolbox    
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.

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,[m n],fun,P1,P2,...) passes the additional parameters P1,P2,..., to fun.

B = nlfilter(A,'indexed',...) processes A as an indexed image, padding with ones if A is of class double and zeros 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

fun can be a function_handle, created using @. This example produces the same result as calling medfilt2 with a 3-by-3 neighborhood.

where myfun is an M-file containing

fun can also be an inline object. The example above can be written as

See Also

blkproc, colfilt


  montage normxcorr2