ivan@78
|
1 function [yl,yh,L] = mrdwt(x,h,L);
|
ivan@78
|
2 % [yl,yh,L] = mrdwt(x,h,L);
|
ivan@78
|
3 %
|
ivan@78
|
4 % Function computes the redundant discrete wavelet transform y
|
ivan@78
|
5 % for a 1D or 2D input signal. (Redundant means here that the
|
ivan@78
|
6 % sub-sampling after each stage is omitted.) yl contains the
|
ivan@78
|
7 % lowpass and yh the highpass components. In the case of a 2D
|
ivan@78
|
8 % signal, the ordering in yh is
|
ivan@78
|
9 % [lh hl hh lh hl ... ] (first letter refers to row, second to
|
ivan@78
|
10 % column filtering).
|
ivan@78
|
11 %
|
ivan@78
|
12 % Input:
|
ivan@78
|
13 % x : finite length 1D or 2D signal (implicitly periodized)
|
ivan@78
|
14 % h : scaling filter
|
ivan@78
|
15 % L : number of levels. In the case of a 1D
|
ivan@78
|
16 % length(x) must be divisible by 2^L;
|
ivan@78
|
17 % in the case of a 2D signal, the row and the
|
ivan@78
|
18 % column dimension must be divisible by 2^L.
|
ivan@78
|
19 % If no argument is
|
ivan@78
|
20 % specified, a full DWT is returned for maximal possible L.
|
ivan@78
|
21 %
|
ivan@78
|
22 % Output:
|
ivan@78
|
23 % yl : lowpass component
|
ivan@78
|
24 % yh : highpass components
|
ivan@78
|
25 % L : number of levels
|
ivan@78
|
26 %
|
ivan@78
|
27 % HERE'S AN EASY WAY TO RUN THE EXAMPLES:
|
ivan@78
|
28 % Cut-and-paste the example you want to run to a new file
|
ivan@78
|
29 % called ex.m, for example. Delete out the % at the beginning
|
ivan@78
|
30 % of each line in ex.m (Can use search-and-replace in your editor
|
ivan@78
|
31 % to replace it with a space). Type 'ex' in matlab and hit return.
|
ivan@78
|
32 %
|
ivan@78
|
33 %
|
ivan@78
|
34 % Example 1::
|
ivan@78
|
35 % x = makesig('Leopold',8);
|
ivan@78
|
36 % h = daubcqf(4,'min');
|
ivan@78
|
37 % L = 1;
|
ivan@78
|
38 % [yl,yh,L] = mrdwt(x,h,L)
|
ivan@78
|
39 % yl = 0.8365 0.4830 0 0 0 0 -0.1294 0.2241
|
ivan@78
|
40 % yh = -0.2241 -0.1294 0 0 0 0 -0.4830 0.8365
|
ivan@78
|
41 % L = 1
|
ivan@78
|
42 % Example 2:
|
ivan@78
|
43 % load lena;
|
ivan@78
|
44 % h = daubcqf(4,'min');
|
ivan@78
|
45 % L = 2;
|
ivan@78
|
46 % [ll_lev2,yh,L] = mrdwt(lena,h,L); % lena is a 256x256 matrix
|
ivan@78
|
47 % N = 256;
|
ivan@78
|
48 % lh_lev1 = yh(:,1:N);
|
ivan@78
|
49 % hl_lev1 = yh(:,N+1:2*N);
|
ivan@78
|
50 % hh_lev1 = yh(:,2*N+1:3*N);
|
ivan@78
|
51 % lh_lev2 = yh(:,3*N+1:4*N);
|
ivan@78
|
52 % hl_lev2 = yh(:,4*N+1:5*N);
|
ivan@78
|
53 % hh_lev2 = yh(:,5*N+1:6*N);
|
ivan@78
|
54 % figure; colormap(gray); imagesc(lena); title('Original Image');
|
ivan@78
|
55 % figure; colormap(gray); imagesc(ll_lev2); title('LL Level 2');
|
ivan@78
|
56 % figure; colormap(gray); imagesc(hh_lev2); title('HH Level 2');
|
ivan@78
|
57 % figure; colormap(gray); imagesc(hl_lev2); title('HL Level 2');
|
ivan@78
|
58 % figure; colormap(gray); imagesc(lh_lev2); title('LH Level 2');
|
ivan@78
|
59 % figure; colormap(gray); imagesc(hh_lev1); title('HH Level 1');
|
ivan@78
|
60 % figure; colormap(gray); imagesc(hl_lev2); title('HL Level 1');
|
ivan@78
|
61 % figure; colormap(gray); imagesc(lh_lev2); title('LH Level 1');
|
ivan@78
|
62 %
|
ivan@78
|
63 % See also: mdwt, midwt, mirdwt
|
ivan@78
|
64 %
|
ivan@78
|
65 % Warning! min(size(x))/2^L should be greater than length(h)
|
ivan@78
|
66 %
|
ivan@78
|
67
|
ivan@78
|
68 %File Name: mrdwt.m
|
ivan@78
|
69 %Last Modification Date: 08/07/95 15:14:47
|
ivan@78
|
70 %Current Version: mrdwt.m 2.4
|
ivan@78
|
71 %File Creation Date: Wed Oct 19 10:51:58 1994
|
ivan@78
|
72 %Author: Markus Lang <lang@jazz.rice.edu>
|
ivan@78
|
73 %
|
ivan@78
|
74 %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved.
|
ivan@78
|
75 %Created by Markus Lang, Department of ECE, Rice University.
|
ivan@78
|
76 %
|
ivan@78
|
77 %This software is distributed and licensed to you on a non-exclusive
|
ivan@78
|
78 %basis, free-of-charge. Redistribution and use in source and binary forms,
|
ivan@78
|
79 %with or without modification, are permitted provided that the following
|
ivan@78
|
80 %conditions are met:
|
ivan@78
|
81 %
|
ivan@78
|
82 %1. Redistribution of source code must retain the above copyright notice,
|
ivan@78
|
83 % this list of conditions and the following disclaimer.
|
ivan@78
|
84 %2. Redistribution in binary form must reproduce the above copyright notice,
|
ivan@78
|
85 % this list of conditions and the following disclaimer in the
|
ivan@78
|
86 % documentation and/or other materials provided with the distribution.
|
ivan@78
|
87 %3. All advertising materials mentioning features or use of this software
|
ivan@78
|
88 % must display the following acknowledgment: This product includes
|
ivan@78
|
89 % software developed by Rice University, Houston, Texas and its contributors.
|
ivan@78
|
90 %4. Neither the name of the University nor the names of its contributors
|
ivan@78
|
91 % may be used to endorse or promote products derived from this software
|
ivan@78
|
92 % without specific prior written permission.
|
ivan@78
|
93 %
|
ivan@78
|
94 %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS,
|
ivan@78
|
95 %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
ivan@78
|
96 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
ivan@78
|
97 %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY
|
ivan@78
|
98 %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
ivan@78
|
99 %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
ivan@78
|
100 %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
ivan@78
|
101 %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
ivan@78
|
102 %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
ivan@78
|
103 %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE
|
ivan@78
|
104 %USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
ivan@78
|
105 %
|
ivan@78
|
106 %For information on commercial licenses, contact Rice University's Office of
|
ivan@78
|
107 %Technology Transfer at techtran@rice.edu or (713) 348-6173
|
ivan@78
|
108 %
|
ivan@78
|
109 %Change History:
|
ivan@78
|
110 %
|
ivan@78
|
111 %Modification #1
|
ivan@78
|
112 %Mon Aug 7 14:26:26 CDT 1995
|
ivan@78
|
113 %Rebecca Hindman <hindman@ece.rice.edu>
|
ivan@78
|
114 %Added L to function line so that it can be displayed as an output
|
ivan@78
|
115 %
|
ivan@78
|
116 %Thursday Mar 2 2000
|
ivan@78
|
117 % Added Example 2
|
ivan@78
|
118 % Felix Fernandes <felixf@rice.edu>
|
ivan@78
|
119
|
ivan@78
|
120
|