Mercurial > hg > smallbox
comparison util/ksvd utils/im2colstep.m @ 70:c3eca463202d
(none)
author | idamnjanovic |
---|---|
date | Wed, 16 Mar 2011 14:16:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
69:5f1f436057ca | 70:c3eca463202d |
---|---|
1 %IM2COLSTEP Rearrange matrix blocks into columns. | |
2 % B = IM2COLSTEP(A,[N1 N2]) converts each sliding N1-by-N2 block of the | |
3 % 2-D matrix A into a column of B, with no zero padding. B has N1*N2 rows | |
4 % and will contain as many columns as there are N1-by-N2 neighborhoods in | |
5 % A. Each column of B contains a neighborhood of A reshaped as NHOOD(:), | |
6 % where NHOOD is a matrix containing an N1-by-N2 neighborhood of A. | |
7 % | |
8 % B = IM2COLSTEP(A,[N1 N2],[S1 S2]) extracts neighborhoods of A with a | |
9 % step size of (S1,S2) between them. The first extracted neighborhood is | |
10 % A(1:N1,1:N2), and the rest are of the form A((1:N1)+i*S1,(1:N2)+j*S2). | |
11 % Note that to ensure coverage of all A by neighborhoods, | |
12 % (size(A,i)-Ni)/Si must be whole for i=1,2. The default function behavior | |
13 % corresponds to [S1 S2] = [1 1]. Setting S1>=N1 and S2>=N2 results in no | |
14 % overlap between the neighborhoods. | |
15 % | |
16 % B = IM2COLSTEP(A,[N1 N2 N3],[S1 S2 S3]) operates on a 3-D matrix A. The | |
17 % step size [S1 S2 S3] may be ommitted, and defaults to [1 1 1]. | |
18 % | |
19 % Note: the call IM2COLSTEP(A,[N1 N2]) produces the same output as | |
20 % Matlab's IM2COL(A,[N1 N2],'sliding'). However, it is significantly | |
21 % faster. | |
22 % | |
23 % See also COL2IMSTEP, IM2COL, COUNTCOVER. | |
24 | |
25 | |
26 % Ron Rubinstein | |
27 % Computer Science Department | |
28 % Technion, Haifa 32000 Israel | |
29 % ronrubin@cs | |
30 % | |
31 % August 2009 |