1 | function J = imup(I) |
---|
2 | % IMUP Downsample an image |
---|
3 | % J=IMUP(I) doubles the resolution of the image I by bilinear |
---|
4 | % interpolation. |
---|
5 | % |
---|
6 | % See also IMDOWN(). |
---|
7 | |
---|
8 | % AUTORIGHTS |
---|
9 | % Copyright (C) 2006 Andrea Vedaldi |
---|
10 | % |
---|
11 | % This file is part of VLUtil. |
---|
12 | % |
---|
13 | % VLUtil is free software; you can redistribute it and/or modify |
---|
14 | % it under the terms of the GNU General Public License as published by |
---|
15 | % the Free Software Foundation; either version 2, or (at your option) |
---|
16 | % any later version. |
---|
17 | % |
---|
18 | % This program is distributed in the hope that it will be useful, |
---|
19 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | % GNU General Public License for more details. |
---|
22 | % |
---|
23 | % You should have received a copy of the GNU General Public License |
---|
24 | % along with this program; if not, write to the Free Software Foundation, |
---|
25 | % Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
26 | |
---|
27 | [M,N,K] = size(I) ; |
---|
28 | |
---|
29 | J = zeros(2*M,2*N,K) ; |
---|
30 | |
---|
31 | J(1:2:end,1:2:end,:) = I ; |
---|
32 | |
---|
33 | J(2:2:end,1:2:end,:) = 0.5*(I+[I(2:end,:,:);I(end,:,:)]) ; |
---|
34 | J(1:2:end,2:2:end,:) = 0.5*(I+[I(:,2:end,:),I(:,end,:)]) ; |
---|
35 | J(2:2:end,2:2:end,:) = ... |
---|
36 | 0.25*(... |
---|
37 | J(2:2:end,1:2:end-1,:)+... |
---|
38 | J(1:2:end-1,2:2:end,:)+... |
---|
39 | [J(2:2:end,3:2:end,:),J(2:2:end,end-1,:)]+... |
---|
40 | [J(3:2:end,2:2:end,:);J(end-1,2:2:end,:)]) ; |
---|