User`s guide

R2009b
12-2
New blockproc Function to Process Large Images
The new blockproc function supports file-based block processing for arbitrarily large
TIFF images. The new function supports in-memory operations as well as file-to-file
processing of images which are too large to load completely into memory.
Compatibility Considerations
In previous releases, you could use the blkproc function for in-memory block-processing
of images. The blkproc function will be removed in a future release. Replace all
instances of blkproc with blockproc.
When updating your code from blkproc to blockproc, it is important to note that the
user-defined function, fun, has a new signature. It now takes a structure, the "block
struct,” as input instead of simply a matrix of image data.
The example below demonstrate how to update your code from blkproc to blockproc.
% BLKPROC code
I = imread('cameraman.tif');
fun = @dct2;
J = blkproc(I,[8 8],fun);
% BLOCKPROC equivalent (using an anonymous function)
fun = @(block_struct) dct2(block_struct.data);
J = blockproc(I,[8 8],fun);
Here’s another example showing how to update your code from blkproc to blockproc.
% BLKPROC code
I = imread('concordorthophoto.png');
h = fspecial('gaussian',[11 11],2.5);
fun = @(x) imfilter(x,h,'conv','same');
J = blkproc(I,[500 500],[5 5],fun);
% BLOCKPROC equivalent (using an anonymous function)
fun = @(block_struct) imfilter(block_struct.data,h,'conv','same');
J = blockproc(I,[500 500],fun,'BorderSize',[5 5]);