Column-wise neighborhood operations
B = colfilt(
A into regions of size
nblock blocks to save memory.
Note that the result of the operation does not change when using the
[mblock nblock] argument.
For example, if
[mblock nblock] is
and the size of each block is 16-by-16 pixels, then
subdivides the image into regions of size 48-by-64 pixels and processes each region
This example shows how to set each output pixel to the mean value of the input pixel's 5-by-5 neighborhood using column-wise neighborhood processing.
Read a grayscale image into the workspace.
I = imread('tire.tif');
Perform column-wise filtering. The function
mean is called on each 5-by-5 pixel neighborhood.
I2 = uint8(colfilt(I,[5 5],'sliding',@mean));
Display the original image and the filtered image.
imshow(I) title('Original Image')
figure imshow(I2) title('Filtered Image')
[m n]— Block size
Block size, specified as a 2-element vector of positive integers.
m is the number of rows and
the number of columns in each block.
[mblock nblock]— Block group size
Block group size, specified as a 2-element vector of positive integers.
mblock is the number of blocks in the group in the
vertical direction, and
nblock is the number of blocks in
the group in the horizontal direction.
block_type— Block type
Block type, specified as
'sliding' for sliding
'distinct' for distinct blocks.
B— Filtered image
Filtered image, returned as a numeric matrix.
The algorithm that
colfilt uses to process images depends on the
To save memory, the
colfilt function might divide
A into subimages and process one subimage at a time. This
fun may be called multiple times, and that the first
fun may have a different number of columns each