Sorry for commenting on my own post, but could someone explain the principle of wavelet tree decomposition. Are each of the levels supposed to give you coefficients at each resolution?
How can I calculate 2D wavelet coefficients for multi resolution analysis given a 2D Array?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am doing a simulation and have a 2 dimensional array that has float values. I am using a metric for my simulation as the L2 Norm of my wavelet coefficients for the 2D array for all resolutions.
I wanted to know, given my 2-D array how I could get the 2D wavelet coefficients for all resolution sizes. I have written some code based on documentation that looks like
wpt = wpdec(cg,3,'db1');
cfs = wpcoef(wpt,[0 0]);
norms = norm(cfs);
Note that in this case, cg is my 2-D array. I am not even sure what this code is doing because I am not familiar with the concept of a wavelet tree. All I truly understand is that wpcoef returns some form of a wavelet coefficient.
How could I modify this code so that I could get the wavelet coefficients at all resolutions? It would also be nice if someone could explain the concepts of wavelet tree decomposition.
3 comentarios
Jon Boerner
el 14 de Oct. de 2014
Hi Varun,
I saw your question and realized I do not have a good grasp of wavelet tree decomposition either. To that end I thought I would try and get up to speed. Turns out the Wavelet Toolbox documentation is actually pretty helpful if you pull out the right pages. For me, I found the following order useful:
- Continuous Wavelet Transform
- Fast Wavelet Transform (FWT) Algorithm
- Wavelet Packet Analysis
- Wavelet Packets
Obviously the first two links are not necessary if you are familiar with wavelets already, but some of the diagrams used there pop up again in the wavelet packet pages, so it might be worth taking a quick look through so the packets sections are easier to follow. There are also a number of other concept-based pages similar to those. If you look in the documentation, for most super-sections, there is a concepts subsection:
To get back to the original question, based on my understanding of the documentation pages, the coefficients from the wavelet packet tree that match up with the coefficients from a DWT will be
wpcoef(wpt,[x 0]);
wpcoef(wpt,[x 1]);
where x is the approximation level you are interested in. The tree on the Wavelet Packet Analysis page shows this relationship.
At a high-level, I believe you are right that the different levels represent different resolutions, as the signal is decimated at each level and passed through the same filter.
It seems like just getting those coefficients defeats the point of using a wavelet packet analysis, however, and that you could get them by just using a DWT.
It might be I am misunderstanding the question? Maybe you could elaborate a bit based on my thoughts here?
Respuestas (2)
Wayne King
el 15 de Oct. de 2014
Hi Varun, Do you want the 2-D wavelet coefficients or wavelet packet coefficients? Those are different transforms. Your post indicates wavelet coefficients, but then your code example uses a wavelet packet decomposition.
Also, it incorrectly uses a 1-D wavelet packet decomposition, wpdec(), as opposed to wpdec2(). If you really want the wavelet packet transform, then you must use wpdec2().
To obtain all the wavelet coefficient matrices at a given resolution level, you can do the following.
I'll use the periodization extension mode.
dwtmode('per','nodisplay');
load woman;
[C,S] = wavedec2(X,4,'bior3.5'); % decompose down to level 4
[H,V,D] = detcoef2('all',C,S,4); % get level 4 coefficients
Replace the 4 with any level 1 to 4 to get the corresponding wavelet coefficients.
The H, V, and D matrices represent the LH, HL, and HH subbands.
You can always just create a loop to store all the 2D wavelet coefficients in a cell array.
clearvars H V D
dwtmode('per','nodisplay');
load woman;
J = 4;
[C,S] = wavedec2(X,J,'bior3.5'); % decompose down to level 4
for jj = 1:J
[H{jj},V{jj},D{jj}] = detcoef2('all',C,S,jj);
end
Hope that helps, Wayne
1 comentario
Afiqah Abu Samah
el 15 de Mzo. de 2017
Hi, I want to ask how to calculate the energy of 2-D wavelet decomposition. I know that function wenergy2 can be use, but I want to know how it can be calculated since I want to use single level 'dwt2' function and decompose the images level-by-level instead of using this; [C,S] = wavedec2(X,2,'bior3.7'). (I have my own reason why I need to decompose it like that)
If 'dwt2' is used, I can't calculate the energy using 'wenergy2' since I didn't know how to get the 'C' array.
Please help me, give me some ideas how to solve this.
Wayne King
el 15 de Oct. de 2014
Varun, to respond to this:
"Sorry for commenting on my own post, but could someone explain the principle of wavelet tree decomposition. Are each of the levels supposed to give you coefficients at each resolution?"
Yes, the wavelet transform is a decomposition of the image by scale, or resolution.
The basic idea of a multiresolution analysis is that the wavelet coefficients at each level (scale) give you the missing detail you need to get to the next higher resolution.
So you combine the lowpass (scaling) approximation to the image at level J with the wavelet coefficients at level J and that gives you the lowpass approximation to the image at level J-1.
You continue this process until you get to level 0 -- and you're back at the original image.
0 comentarios
Ver también
Categorías
Más información sobre Signal Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!