how to encode and decode IWT until 9 level
1 次查看(过去 30 天)
显示 更早的评论
hi, I'm having a problem in performing IWT for 9 level. I already had matlab code for the first level, but I don't know how to do until 9 level of image decomposition. anybody know how to solve this ? this is the matlab code :
clear all; close all; clc; F=imread('lena.bmp'); i2=double(F); F1=uint8(F); figure(1); imshow(F,[]); title('Original Image'); E0=entropy(uint8([F1]));
%lifting scheme
h1=[-1 9 9 1]/(16*1.5); h2=[0 0 1 1]/(-4*1.5);
%rows o=i2(:,1:2:size(i2,2)); e=i2(:,2:2:size(i2,2)); y0=e-round(filter2(h1,o)); y1=o+round(filter2(h2,y0));
%column y00=y1(1:2:size(y1,1),:); y01=y1(2:2:size(y1,1),:); sd=y01-round(filter2(h1,y00)); ss=y00+round(filter2(h2,sd));
%column y10=y0(1:2:size(y0,1),:); y11=y0(2:2:size(y0,1),:); dd=y11-round(filter2(h1,y10)); ds=y10+round(filter2(h2,dd)); figure(2) im=[ss sd;ds dd]; imshow(uint8(im)); title('Image Obtained after Subband Coding');
%compression [m1 n1]=size(ss); [m2 n2]=size(sd); [m3 n3]=size(ds); [m4 n4]=size(dd); E=entropy(uint8([ss sd;ds dd]));
%finding entropy %E0=entropy1(im); %E=entropy1(im1); E1=entropy(ss); E2=entropy(sd); E3=entropy(ds); E4=entropy(dd); total=(1/4)*(E1+E2+E3+E4);
%reconstruction x00=ss-round(filter2(h2,sd)); x01=sd+round(filter2(h1,x00)); x0(1:2:2*size(x00,1),:)=x00; x0(2:2:2*size(x01,1),:)=x01; x10=ds-round(filter2(h2,dd)); x11=dd+round(filter2(h1,x10)); x1(1:2:2*size(x10,1),:)=x10; x1(2:2:2*size(x11,1),:)=x11; z0=x0-round(filter2(h2,x1)); z1=x1+round(filter2(h1,z0)); z(:,1:2:2*size(z0,2))=z0; z(:,2:2:2*size(z1,2))=z1;
figure(5); imshow(((z)),[]); title('Image after inverse IWT');
I=(z)-double(F); figure(7); imshow(I,[]); title('Difference of Original and Restructured');
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Point Cloud Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!