How can I calculate 2D wavelet coefficients for multi resolution analysis given a 2D Array?

10 ビュー (過去 30 日間)
Varun Mohan
Varun Mohan 2014 年 10 月 12 日
コメント済み: Afiqah Abu Samah 2017 年 3 月 15 日
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 件のコメント
Jon Boerner
Jon Boerner 2014 年 10 月 14 日
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:
  1. Continuous Wavelet Transform
  2. Fast Wavelet Transform (FWT) Algorithm
  3. Wavelet Packet Analysis
  4. 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?
Varun Mohan
Varun Mohan 2014 年 10 月 15 日
Hi Jon,
Thanks for the response. First, I should give some more reasoning as to why I need just the coefficients.
I am simulating a cellular automaton and trying to determine the "complexity" of the system. In other words, how much variation there is at different resolutions.
I have read that considering the L2 Norms of the wavelets at each of the resolutions is a good indicator about the autocorrelation of the system, and whether or not there is an aspect of "randomness" in the system. Hence, the idea behind using the wavelets is not because I want to manipulate the coefficients to create a new image, but rather that I wish to sample the coefficients.
Therefore, my original question should have been how can I get the coefficients at each of these resolutions. I did find your links useful but I still have some confusion. The tree, essentially, sequentially splits the signal into detail and noise, based on the number of filters (this is my understanding).
My question would therefore be: is the tree useful in getting the wavelet coefficients at each resolution? If not, how can I get the wavelet coefficients for each resolution? Also, then based on your comment above, is the code cfs = wpcoef(wpt,[0 0]); getting the wavelet coefficients for the entire system?
Thanks, Varun Mohan

サインインしてコメントする。

回答 (2 件)

Wayne King
Wayne King 2014 年 10 月 15 日
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 件のコメント
Afiqah Abu Samah
Afiqah Abu Samah 2017 年 3 月 15 日
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
Wayne King 2014 年 10 月 15 日
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.

カテゴリ

Help Center および File ExchangeSignal Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by