WT2D Two dimensional Wavelet Transform. WT2D(X,H,G,SCALES) calculates the 2D wavelet transform of matrix X at SCALES scales. H is the analysis lowpass filter and G is the highpass one. At every scale, the lowpass residue is placed at the top-left corner of the corresponding subimage, the horizontal high frequency band at the top-right, the vertical high frequency band at the bottom-left and the diagonal high frequency band at the bottom-right. Every successive wavelet subimage substitutes the residue of the previous scale. Example with 2 scales: _______ 2nd scale substituting the --> |_|_| | <-- 1st scale first scale lowpass residue |_|_|___| horiz. detail | | | 1st scale ----> |___|___| <-- 1st scale vertical detail diagonal detail WT2D (X,H,G,SCALES,DEL1,DEL2) will perform the transformation but allowing the user to change the alignment of the output subimages with respect to the input image. This effect is achieved by setting to DEL1 and DEL2 the delays of H and G respectively. The default values of DEL1 and DEL2 are calculated using the function WTCENTER. This function is a wrapper for wtnd, for compatibility with UviWave. See below for UviWave copyright. See also: WTND, IWT, IWTND, WTCENTER, ISPLIT. $Id: wt2d.m,v 1.1 2004/09/26 04:00:24 matthewbrett Exp $
0001 function y=wt2d(x,h,g,scales,del1,del2) 0002 % WT2D Two dimensional Wavelet Transform. 0003 % 0004 % WT2D(X,H,G,SCALES) calculates the 2D wavelet transform of matrix X 0005 % at SCALES scales. H is the analysis lowpass filter and G is the 0006 % highpass one. 0007 % 0008 % At every scale, the lowpass residue is placed at the top-left corner 0009 % of the corresponding subimage, the horizontal high frequency band at 0010 % the top-right, the vertical high frequency band at the bottom-left 0011 % and the diagonal high frequency band at the bottom-right. Every 0012 % successive wavelet subimage substitutes the residue of the previous 0013 % scale. 0014 % 0015 % Example with 2 scales: 0016 % _______ 0017 % 2nd scale substituting the --> |_|_| | <-- 1st scale 0018 % first scale lowpass residue |_|_|___| horiz. detail 0019 % | | | 0020 % 1st scale ----> |___|___| <-- 1st scale 0021 % vertical detail diagonal detail 0022 % 0023 % WT2D (X,H,G,SCALES,DEL1,DEL2) will perform the transformation but 0024 % allowing the user to change the alignment of the output subimages 0025 % with respect to the input image. This effect is achieved by setting 0026 % to DEL1 and DEL2 the delays of H and G respectively. The default 0027 % values of DEL1 and DEL2 are calculated using the function WTCENTER. 0028 % 0029 % This function is a wrapper for wtnd, for compatibility with UviWave. See 0030 % below for UviWave copyright. 0031 % 0032 % See also: WTND, IWT, IWTND, WTCENTER, ISPLIT. 0033 % 0034 % $Id: wt2d.m,v 1.1 2004/09/26 04:00:24 matthewbrett Exp $ 0035 0036 %-------------------------------------------------------- 0037 % Copyright (C) 1994, 1995, 1996, by Universidad de Vigo 0038 % 0039 % 0040 % Uvi_Wave is free software; you can redistribute it and/or modify it 0041 % under the terms of the GNU General Public License as published by the 0042 % Free Software Foundation; either version 2, or (at your option) any 0043 % later version. 0044 % 0045 % Uvi_Wave is distributed in the hope that it will be useful, but WITHOUT 0046 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0047 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0048 % for more details. 0049 % 0050 % You should have received a copy of the GNU General Public License 0051 % along with Uvi_Wave; see the file COPYING. If not, write to the Free 0052 % Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 0053 % 0054 % Author: Sergio J. Garcia Galan 0055 % e-mail: Uvi_Wave@tsc.uvigo.es 0056 %-------------------------------------------------------- 0057 0058 if nargin < 3 0059 error('Need data to transform and two filters'); 0060 end 0061 if nargin < 4 0062 scales = []; 0063 end 0064 if nargin < 5 0065 del1 = []; 0066 end 0067 if nargin < 6 0068 del2 = []; 0069 end 0070 0071 n_dims = ndims(x); 0072 p_dims = [1 1 zeros(1, n_dims-2)]; 0073 0074 if n_dims > 2 0075 warning('wt2d does a 2D transform; use wtnd for N-D transforms'); 0076 end 0077 y = wtnd(x, h, g, scales, del1, del2, p_dims);