IWT2D Two dimensional Inverse Wavelet Transform. IWT2D(WX,RH,RG,SCALES) calculates the two dimensional inverse wavelet transform of matrix WX, which is supposed to be a two dimensional SCALES-scales direct wavelet transform of any matrix or image. RH is the synthesis lowpass filter and RG is the synthesis highpass filter. The original image size can be provided by specifying IWT2D (WX,RH,RG,SCALES,SIZX,SIZY). If any of SIZX or SIZY is not given or set to zero, IWT2D will calculate the maximum for the direction. IWT2D can be used to perform a single process of multiresolution analysis. The way to do it is by selecting the scales whose highpass bands (detail signals) should be ignored for reconstruction. Using IWT2D (WX,RH,RG,SCALES,SIZX,SIZY,SC_LEVELS) where SC_LEVELS is a SCALES-sized vector, 1's or 0's. An i-th coefficient of 0 means that the i-th scale detail images (starting from the deepest) should be ignored. The SC_LEVELS vector can be replaced by a single number for selecting just only the SC_LEVELS deepest scales. An all-ones vector, or a single number equal to SCALES, is the same as the normal inverse transform. IWT2D (WX,RH,RG,SCALES,SIZX,SIZY,SC_LEVELS,DEL1,DEL2) calculates the inverse transform or performs the multiresolution analysis, but allowing the users to change the alignment of the outputs with respect to the input signal. This effect is achieved by setting to DEL1 and DEL2 the analysis delays of H and G respectively, and calculating the complementary delays for synthesis filters RH and RG. The default values of DEL1 and DEL2 are calculated using the function WTCENTER. This function is a wrapper for iwtnd, for compatibility with UviWave. See below for UviWave copyright. See also: WTND, IWT, IWTND, WTCENTER, ISPLIT. $Id: iwt2d.m,v 1.1 2004/09/26 04:00:24 matthewbrett Exp $
0001 function y=iwt2d(wx,rh,rg,scales,sizx,sizy,sc_levels,del1,del2) 0002 % IWT2D Two dimensional Inverse Wavelet Transform. 0003 % 0004 % IWT2D(WX,RH,RG,SCALES) calculates the two dimensional inverse 0005 % wavelet transform of matrix WX, which is supposed to be a two 0006 % dimensional SCALES-scales direct wavelet transform of any matrix or 0007 % image. RH is the synthesis lowpass filter and RG is the synthesis 0008 % highpass filter. 0009 % 0010 % The original image size can be provided by specifying IWT2D 0011 % (WX,RH,RG,SCALES,SIZX,SIZY). If any of SIZX or SIZY is not given or 0012 % set to zero, IWT2D will calculate the maximum for the direction. 0013 % 0014 % IWT2D can be used to perform a single process of multiresolution 0015 % analysis. The way to do it is by selecting the scales whose highpass 0016 % bands (detail signals) should be ignored for reconstruction. 0017 % 0018 % Using IWT2D (WX,RH,RG,SCALES,SIZX,SIZY,SC_LEVELS) where SC_LEVELS is 0019 % a SCALES-sized vector, 1's or 0's. An i-th coefficient of 0 means that 0020 % the i-th scale detail images (starting from the deepest) should be 0021 % ignored. The SC_LEVELS vector can be replaced by a single number 0022 % for selecting just only the SC_LEVELS deepest scales. 0023 % 0024 % An all-ones vector, or a single number equal to SCALES, is the same 0025 % as the normal inverse transform. 0026 % 0027 % IWT2D (WX,RH,RG,SCALES,SIZX,SIZY,SC_LEVELS,DEL1,DEL2) calculates the 0028 % inverse transform or performs the multiresolution analysis, but 0029 % allowing the users to change the alignment of the outputs with 0030 % respect to the input signal. This effect is achieved by setting to 0031 % DEL1 and DEL2 the analysis delays of H and G respectively, and 0032 % calculating the complementary delays for synthesis filters RH and 0033 % RG. The default values of DEL1 and DEL2 are calculated using the 0034 % function WTCENTER. 0035 % 0036 % This function is a wrapper for iwtnd, for compatibility with UviWave. See 0037 % below for UviWave copyright. 0038 % 0039 % See also: WTND, IWT, IWTND, WTCENTER, ISPLIT. 0040 % 0041 % $Id: iwt2d.m,v 1.1 2004/09/26 04:00:24 matthewbrett Exp $ 0042 0043 %-------------------------------------------------------- 0044 % Copyright (C) 1994, 1995, 1996, by Universidad de Vigo 0045 % 0046 % 0047 % Uvi_Wave is free software; you can redistribute it and/or modify it 0048 % under the terms of the GNU General Public License as published by the 0049 % Free Software Foundation; either version 2, or (at your option) any 0050 % later version. 0051 % 0052 % Uvi_Wave is distributed in the hope that it will be useful, but WITHOUT 0053 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0054 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0055 % for more details. 0056 % 0057 % You should have received a copy of the GNU General Public License 0058 % along with Uvi_Wave; see the file COPYING. If not, write to the Free 0059 % Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 0060 % 0061 % Author: Sergio J. Garcia Galan 0062 % e-mail: Uvi_Wave@tsc.uvigo.es 0063 %-------------------------------------------------------- 0064 0065 if nargin < 4 0066 error('Need data to iwt, two filters and number of scales'); 0067 end 0068 if nargin < 5 0069 sizx = []; 0070 end 0071 if nargin < 6 0072 sizy = []; 0073 end 0074 if nargin < 7 0075 sc_levels = []; 0076 end 0077 if nargin < 8 0078 del1 = []; 0079 end 0080 if nargin < 9 0081 del2 = []; 0082 end 0083 0084 n_dims = ndims(wx); 0085 p_dims = [1 1 zeros(1, n_dims-2)]; 0086 0087 if n_dims > 2 0088 warning('iwt2d does a 2D transform; use iwtnd for N-D transforms'); 0089 end 0090 0091 % Note that UviWave iwt2d takes the first passed size as the width 0092 % (number of columns) and the second passed size as the height (number of 0093 % rows) whereas wtnd follows the matlab convention of number of rows 0094 % first, then number of columns 0095 y = iwtnd(wx, rh, rg, scales, [sizy sizx], sc_levels, del1, del2, p_dims);