What is the comments given in this IWT code?
显示 更早的评论
Hello,
I am not able to read and understand the comments given in the following code.I got this from net and also not able to understand steps followed in this code.Please help me in this regard.
function y=IWT(x)
x=imread('lenna.gif');
subplot(2,3,1);imshow(x);title('ÔͼÏñ');
x=double(x);
y=x;
[hp,lp]=size(x);
hc=hp/2; lc=lp/2;
%----------------ÆæÅ¼ÁÐÖØÅÅ
for n=1:lc
j=n*2-1;
y(:,n)=x(:,j);
y(:,lc+n)=x(:,j+1);
end
subplot(2,3,2);imshow(uint8(y)); title('ÆæÅ¼ÁÐÖØÅÅ');
%-----------------ÐÐÖØÅÅ
for n=1:lc
y(:,lc+n)=y(:,lc+n)-y(:,n);
end
for n=1:lc
k=y(:,lc+n)/2-mod(y(:,lc+n)/2,1);
y(:,n)=y(:,n)+k;
end
subplot(2,3,3);imshow(uint8(y));title('ÐÐÖØÅÅ');
%---------------ÆæÅ¼ÐÐÖØÅÅ
x=y;
for n=1:hc
j=n*2-1;
y(n,:)=x(j,:);
y(hc+n,:)=x(j+1,:);
end
subplot(2,3,4);imshow(uint8(y));title('ÆæÅ¼ÐÐÖØÅÅ');
%---------------ÁÐÖØÅÅ
for n=1:hc
y(hc+n,:)=y(hc+n,:)-y(n,:);
end
for n=1:hc
k=y(hc+n,:)/2-mod(y(hc+n,:)/2,1);
y(n,:)=y(n,:)+k;
end
subplot(2,3,5);imshow(uint8(y));title('ÁÐÖØÅÅ');
%----------------ÖØ¸´ÉÏÊö²½Ö裬½øÐжþ´ÎѹËõ
for n=1:lc
j=n*2-1;
y(:,n)=x(:,j);
y(:,lc+n)=x(:,j+1);
end
for n=1:lc
y(:,lc+n)=y(:,lc+n)-y(:,n);
end
for n=1:lc
k=y(:,lc+n)/2-mod(y(:,lc+n)/2,1);
y(:,n)=y(:,n)+k;
end
x=y;
for n=1:hc
j=n*2-1;
y(n,:)=x(j,:);
y(hc+n,:)=x(j+1,:);
end
for n=1:hc
y(hc+n,:)=y(hc+n,:)-y(n,:);
end
for n=1:hc
k=y(hc+n,:)/2-mod(y(hc+n,:)/2,1);
y(n,:)=y(n,:)+k;
end
%----------------ÔÙ½øÐÐÆæÅ¼ÐÐÖØÅźÍÁÐÖØÅÅ
x=y;
for n=1:hc
j=n*2-1;
y(n,:)=x(j,:);
y(hc+n,:)=x(j+1,:);
end
for n=1:hc
y(hc+n,:)=y(hc+n,:)-y(n,:);
end
for n=1:hc
k=y(hc+n,:)/2-mod(y(hc+n,:)/2,1);
y(n,:)=y(n,:)+k;
end
subplot(2,3,6);imshow(uint8(y));title('¶þ´ÎѹËõ ');
5 个评论
Sara msr
2017-8-12
this code was very useful. Do you also have the inverse iwt code? i realy need it.
Walter Roberson
2017-8-12
The comments that show up here are comments originally written in UTF-8 but the code has been saved as if it were ASCII and the extra bytes needed to decode it have been lost.
I do not happen to find a copy of the original code anywhere; if the original were available then the comments could be run through a translator.
nur aqila
2017-11-27
hye sara, im having the same problem as you. I dont know how to do inverse iwt. have found the solution ?
rizky alvarez
2021-2-26
hi sara and nur, so do i, i m still not understand waht the meaning on this code, have find the solution what is the meaning on this code ?
Walter Roberson
2021-3-2
Have you managed to find an original source for the code? (Something other than this post) ?
回答(2 个)
Wayne King
2013-3-4
编辑:Wayne King
2013-3-4
0 个投票
I think you have to inquire with the individuals that provided this code.
Do you have the MathWorks Wavelet Toolbox? If so you can implement both the 2-D DWT and the inverse DWT using that Toolbox.
1 个评论
Pooja
2013-3-4
编辑:Walter Roberson
2017-8-12
Wayne King
2013-3-4
Have you read the help for dwt2? You need to specify a wavelet name (or the filters) to use.
It's better to use wavedec2 because you can specify the level that you want.
wavedec2 uses dwt2.m internally but handles the iteration for you.
imdata = imread('ngc6543a.jpg');
[C,S] = wavedec2(imdata,3,'bior3.5');
4 个评论
Pooja
2013-3-4
Wayne King
2013-3-4
You can extract the detail or approximation coefficients at any level with
detcoef2() or appcoef2()
Pooja
2013-5-6
Deepika
2013-10-20
Hello Pooja, Mr. Wayne King is right. After that you should write imshow(). Then, you will get the what you want.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!