source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vlutil/toolbox/imup.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.3 KB
Line 
1function 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
29J = zeros(2*M,2*N,K) ;
30
31J(1:2:end,1:2:end,:) = I ;
32
33J(2:2:end,1:2:end,:) = 0.5*(I+[I(2:end,:,:);I(end,:,:)]) ;
34J(1:2:end,2:2:end,:) = 0.5*(I+[I(:,2:end,:),I(:,end,:)]) ;
35J(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,:)]) ;
Note: See TracBrowser for help on using the repository browser.