Haar Wavelet..

14 ビュー (過去 30 日間)
Aditya
Aditya 2011 年 8 月 25 日
Hey, I have to basically input a 128*128 Haar Wavelet Matrix. Thing is, I'll either have to code it in or hardcode the values myself. Does anyone know any inbuilt class or any function I can use to save any time????

回答 (2 件)

Wayne King
Wayne King 2011 年 8 月 25 日
Hi Aditya, Can you be more specific what you mean by the Haar wavelet matrix? Are you attempting to implement a 1-D DWT using the Haar wavelet? And if so, is it necessary that you implement as a matrix multiplication. If you have the Wavelet Toolbox, there are much more efficients ways to do it.
Wayne
  1 件のコメント
Aditya
Aditya 2011 年 8 月 25 日
Hey! Thanks for your quick reply. I want a 2-D Haar Matrix...
like... 1 1 1 1
1 1 -1 -1
1 -1 0 0
0 0 1 -1
only well, for 128 rows and columns. I will then carry out the squaring of elements and division. Is there any inbuilt function or code which foes all this? Or will I have to do it on my own?

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


mukala gayatri
mukala gayatri 2020 年 9 月 23 日
function H=haarmtx(n)
% HAARMTX Compute Haar orthogonal transform matrix.
%
% H = HAARMTX(N) returns the N-by-N HAAR transform matrix. H*A
% is the HAAR transformation of the columns of A and H'*A is the inverse
% transformation of the columns of A (when A is N-by-N).
% If A is square, the two-dimensional Haar transformation of A can be computed
% as H*A*H'. This computation is sometimes faster than using
% DCT2, especially if you are computing large number of small
% Haar transformation, because H needs to be determined only once.
%% Class Support
% -------------
% N is an integer scalar of class double. H is returned
% as a matrix of class double.
%
%
% I/O Spec
% N - input must be double
% D - output DCT transform matrix is double
%
% Author : Frederic Chanal (f.j.chanal@student.tue.nl) - 2004
a=1/sqrt(n);
for i=1:n
H(1,i)=a;
end
for k=1:n-1
p=fix(log2(k));
q=k-2^p+1;
t1=n/2^p;
sup=fix(q*t1);
mid=fix(sup-t1/2);
inft=fix(sup-t1);
t2=2^(p/2)*a;
for j=1:inft
H(k+1,j)=0;
end
for j=inft+1:mid
H(k+1,j)=t2;
end
for j=mid+1:sup
H(k+1,j)=-t2;
end
for j=sup+1:n
H(k+1,j)=0;
end
end
  1 件のコメント
Laura Carballo-Sigler
Laura Carballo-Sigler 2023 年 2 月 19 日
this is awesome!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by