ivan@78
|
1 function [y,L] = mdwt(x,h,L);
|
ivan@78
|
2 % [y,L] = mdwt(x,h,L);
|
ivan@78
|
3 %
|
ivan@78
|
4 % Function computes the discrete wavelet transform y for a 1D or 2D input
|
ivan@78
|
5 % signal x using the scaling filter h.
|
ivan@78
|
6 %
|
ivan@78
|
7 % Input:
|
ivan@78
|
8 % x : finite length 1D or 2D signal (implicitly periodized)
|
ivan@78
|
9 % h : scaling filter
|
ivan@78
|
10 % L : number of levels. In the case of a 1D signal, length(x) must be
|
ivan@78
|
11 % divisible by 2^L; in the case of a 2D signal, the row and the
|
ivan@78
|
12 % column dimension must be divisible by 2^L. If no argument is
|
ivan@78
|
13 % specified, a full DWT is returned for maximal possible L.
|
ivan@78
|
14 %
|
ivan@78
|
15 % Output:
|
ivan@78
|
16 % y : the wavelet transform of the signal
|
ivan@78
|
17 % (see example to understand the coefficients)
|
ivan@78
|
18 % L : number of decomposition levels
|
ivan@78
|
19 %
|
ivan@78
|
20 % 1D Example:
|
ivan@78
|
21 % x = makesig('LinChirp',8);
|
ivan@78
|
22 % h = daubcqf(4,'min');
|
ivan@78
|
23 % L = 2;
|
ivan@78
|
24 % [y,L] = mdwt(x,h,L)
|
ivan@78
|
25 %
|
ivan@78
|
26 % 1D Example's output and explanation:
|
ivan@78
|
27 %
|
ivan@78
|
28 % y = [1.1097 0.8767 0.8204 -0.5201 -0.0339 0.1001 0.2201 -0.1401]
|
ivan@78
|
29 % L = 2
|
ivan@78
|
30 %
|
ivan@78
|
31 % The coefficients in output y are arranged as follows
|
ivan@78
|
32 %
|
ivan@78
|
33 % y(1) and y(2) : Scaling coefficients (lowest frequency)
|
ivan@78
|
34 % y(3) and y(4) : Band pass wavelet coefficients
|
ivan@78
|
35 % y(5) to y(8) : Finest scale wavelet coefficients (highest frequency)
|
ivan@78
|
36 %
|
ivan@78
|
37 % 2D Example:
|
ivan@78
|
38 %
|
ivan@78
|
39 % load test_image
|
ivan@78
|
40 % h = daubcqf(4,'min');
|
ivan@78
|
41 % L = 1;
|
ivan@78
|
42 % [y,L] = mdwt(test_image,h,L);
|
ivan@78
|
43 %
|
ivan@78
|
44 % 2D Example's output and explanation:
|
ivan@78
|
45 %
|
ivan@78
|
46 % The coefficients in y are arranged as follows.
|
ivan@78
|
47 %
|
ivan@78
|
48 % .------------------.
|
ivan@78
|
49 % | | |
|
ivan@78
|
50 % | 4 | 2 |
|
ivan@78
|
51 % | | |
|
ivan@78
|
52 % | L,L | H,L |
|
ivan@78
|
53 % | | |
|
ivan@78
|
54 % --------------------
|
ivan@78
|
55 % | | |
|
ivan@78
|
56 % | 3 | 1 |
|
ivan@78
|
57 % | | |
|
ivan@78
|
58 % | L,H | H,H |
|
ivan@78
|
59 % | | |
|
ivan@78
|
60 % `------------------'
|
ivan@78
|
61 %
|
ivan@78
|
62 % where
|
ivan@78
|
63 % 1 : High pass vertically and high pass horizontally
|
ivan@78
|
64 % 2 : Low pass vertically and high pass horizontally
|
ivan@78
|
65 % 3 : High pass vertically and low pass horizontally
|
ivan@78
|
66 % 4 : Low pass vertically and Low pass horizontally
|
ivan@78
|
67 % (scaling coefficients)
|
ivan@78
|
68 %
|
ivan@78
|
69 %
|
ivan@78
|
70 %
|
ivan@78
|
71 %
|
ivan@78
|
72 % See also: midwt, mrdwt, mirdwt
|
ivan@78
|
73 %
|
ivan@78
|
74
|
ivan@78
|
75 %File Name: mdwt.m
|
ivan@78
|
76 %Last Modification Date: 08/07/95 15:13:25
|
ivan@78
|
77 %Current Version: mdwt.m 2.4
|
ivan@78
|
78 %File Creation Date: Wed Oct 19 10:51:58 1994
|
ivan@78
|
79 %Author: Markus Lang <lang@jazz.rice.edu>
|
ivan@78
|
80 %
|
ivan@78
|
81 %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved.
|
ivan@78
|
82 %Created by Markus Lang, Department of ECE, Rice University.
|
ivan@78
|
83 %
|
ivan@78
|
84 %This software is distributed and licensed to you on a non-exclusive
|
ivan@78
|
85 %basis, free-of-charge. Redistribution and use in source and binary forms,
|
ivan@78
|
86 %with or without modification, are permitted provided that the following
|
ivan@78
|
87 %conditions are met:
|
ivan@78
|
88 %
|
ivan@78
|
89 %1. Redistribution of source code must retain the above copyright notice,
|
ivan@78
|
90 % this list of conditions and the following disclaimer.
|
ivan@78
|
91 %2. Redistribution in binary form must reproduce the above copyright notice,
|
ivan@78
|
92 % this list of conditions and the following disclaimer in the
|
ivan@78
|
93 % documentation and/or other materials provided with the distribution.
|
ivan@78
|
94 %3. All advertising materials mentioning features or use of this software
|
ivan@78
|
95 % must display the following acknowledgment: This product includes
|
ivan@78
|
96 % software developed by Rice University, Houston, Texas and its contributors.
|
ivan@78
|
97 %4. Neither the name of the University nor the names of its contributors
|
ivan@78
|
98 % may be used to endorse or promote products derived from this software
|
ivan@78
|
99 % without specific prior written permission.
|
ivan@78
|
100 %
|
ivan@78
|
101 %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS,
|
ivan@78
|
102 %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
ivan@78
|
103 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
ivan@78
|
104 %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY
|
ivan@78
|
105 %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
ivan@78
|
106 %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
ivan@78
|
107 %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
ivan@78
|
108 %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
ivan@78
|
109 %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
ivan@78
|
110 %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE
|
ivan@78
|
111 %USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
ivan@78
|
112 %
|
ivan@78
|
113 %For information on commercial licenses, contact Rice University's Office of
|
ivan@78
|
114 %Technology Transfer at techtran@rice.edu or (713) 348-6173
|
ivan@78
|
115 %
|
ivan@78
|
116 %Change History:
|
ivan@78
|
117 %
|
ivan@78
|
118 %Modification #1
|
ivan@78
|
119 %Mon Aug 7 11:42:11 CDT 1995
|
ivan@78
|
120 %Rebecca Hindman <hindman@ece.rice.edu>
|
ivan@78
|
121 %Added L to function line so that it can be displayed as an output
|
ivan@78
|
122 %
|
ivan@78
|
123 %Change History:
|
ivan@78
|
124 %
|
ivan@78
|
125 %Modification #1
|
ivan@78
|
126 %Thu Mar 2 13:07:11 CDT 2000
|
ivan@78
|
127 %Ramesh Neelamani<neelsh@ece.rice.edu>
|
ivan@78
|
128 %Revamped the help file
|
ivan@78
|
129 %
|
ivan@78
|
130
|
ivan@78
|
131
|
ivan@78
|
132
|