Image Processing Toolbox User's Guide |
Rearrange image blocks into columns
Syntax
Description
B = im2col(A,[m n],block_type)
rearranges image blocks into columns. block_type
is a string that can have one of these values. The default value is enclosed in braces ({}
).
For the sliding block case, each column of B
contains the neighborhoods of A
reshaped as nhood(:)
where nhood
is a matrix containing an m
-by-n
neighborhood of A
. im2col
orders the columns of B
so that they can be reshaped to form a matrix in the normal way. For example, suppose you use a function, such as sum(B)
, that returns a scalar for each column of B
. You can directly store the result in a matrix of size (mm-m+1
)-by-(nn-n+1
), using these calls.
B = im2col(A,'indexed',...)
processes A
as an indexed image, padding with 0's if the class of A
is uint8
, or 1's if the class of A
is double
.
Class Support
The input image A
can be numeric or logical. The output matrix B
is of the same class as the input image.
See Also
blkproc
, col2im
, colfilt
, nlfilter
im2bw | im2double |
© 1994-2005 The MathWorks, Inc.