You are here : matlabImage Processingblockproc

blockproc() - Image Processing

B = blockproc(A,blockSize,fun) processes the image A by applying the function fun to each distinct block of A and concatenating the results into B, the output matrix. blockSize is a two-element vector, [rows cols], that specifies the size of the block.fun is a handle to a function that accepts a block struct as input and returns a matrix, vector, or scalar Y.

For example, Y = fun(block_struct). (For more information about a block struct, see the Definition section below.) For each block of data in the input image, A, blockproc passes the block in a block struct to the user function, fun, to produce Y, the corresponding block in the output image.

If Y is empty, blockproc does not generate any output and returns empty after processing all blocks.

Choosing an appropriate block size can significantly improve performance.

For more information, see Choosing Block Size. For more information about function handles, see Create Function Handle.

B = blockproc(src_filename,blockSize,fun) processes the image src_filename, reading and processing one block at a time.

This syntax is useful for processing very large images since only one block of the image is read into memory at a time.

If the output matrix B is too large to fit into memory, omit the output argument and instead use the 'Destination' parameter/value pair to write the output to a file.

B = blockproc(adapter,blockSize,fun) processes the source image specified by adapter, an ImageAdapter object.

An ImageAdapter is a user-defined class that provides blockproc with a common API for reading and writing to a particular image file format.

blockproc(___,Name,Value,...) processes the input image, specifying parameters and corresponding values that control various aspects of the block behavior. Parameter names are not case sensitive.


Syntax

B = blockproc(A,blockSize,fun)
B = blockproc(src_filename,blockSize,fun)
B = blockproc(adapter,blockSize,fun)
blockproc(___,Name,Value,...)


Example

[M + 2*V, N + 2*H]


Output / Return Value


Limitations


Alternatives / See Also


Reference