Image Processing Toolbox
  Go to function:
    Search    Help Desk 
blkproc    Examples   See Also

Implement distinct block processing for an image

Syntax

Description

B = blkproc(A,[m n],fun) processes the image A by applying the function fun to each distinct m-by-n block of A, padding A with zeros if necessary. fun can be an inline function, a text string containing the name of a function, or a string containing an expression. fun should operate on an m-by-n block, x, and return a matrix, vector, or scalar y.

blkproc does not require that y be the same size as x. However, B is the same size as A only if y is the same size as x.

B = blkproc(A,[m n],fun,P1,P2,...) passes the additional parameters P1,P2,..., to fun.

B = blkproc(A,[m n],[mborder nborder],fun,...) defines an overlapping border around the blocks. blkproc extends the original m-by-n blocks by mborder on the top and bottom, and nborder on the left and right, resulting in blocks of size (m+2*mborder)-by-(n+2*nborder). blkproc pads the border with zeros, if necessary, on the edges of A. fun should operate on the extended block.

The line below processes an image matrix as 4-by-6 blocks, each having a row border of 2 and a column border of 3. Because each 4-by-6 block has this 2-by-3 border, fun actually operates on blocks of size 8-by-12.

B = blkproc(A,'indexed',...) processes A as an indexed image, padding with zeros if the class of A is uint8 or uint16, or ones if the class of A is double.

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.

Example

This example uses blkproc to set the pixels in each 8-by-8 block to the standard deviation of the elements in that block.

See Also

colfilt, nlfilter, inline



[ Previous | Help Desk | Next ]