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

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 0's if necessary. fun is a function handle that accepts an m-by-n matrix, x, and returns 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],[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). The blkproc function pads the border with 0's, if necessary, on the edges of A. The function 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 0's if the class of A is uint8 or uint16, or 1's 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 compute the 2-D DCT of each 8-by-8 block to the standard deviation of the elements in that block. In this example, fun is specified as a function handle created using @.

This example uses blkproc to set the pixels in each 16-by-16 block to the standard deviation of the elements in that block. In this example, fun is specified as an anonymous function.

See Also

bestblk, colfilt, nlfilter, function_handle


Previous page  bestblk brighten Next page

© 1994-2005 The MathWorks, Inc.