1、I=imread(E:MATLAB代码tupian2.PNG);/图片所在文件、名称和类型X=imresize(I,256,256); B=rgb2gray(X);subplot(121),imshow(B,InitialMagnification,100);title(原始灰度图像)c,s=wavedec2(double(B),3,haar);ca1=appcoef2(c,s,haar,1);chd1=detcoef2(h,c,s,1);cvd1=detcoef2(v,c,s,1);cdd1=detcoef2(d,c,s,1);ca2=appcoef2(c,s,haar,2);chd2=de
2、tcoef2(h,c,s,2);cvd2=detcoef2(v,c,s,2);cdd2=detcoef2(d,c,s,2);ca3=appcoef2(c,s,haar,3);chd3=detcoef2(h,c,s,3);cvd3=detcoef2(v,c,s,3);cdd3=detcoef2(d,c,s,3);A3 = ca3*4,chd3*4;cvd3*4,cdd3*4;k=s(2,1)*2-s(3,1);chd2 = padarray(chd2,k k,1,post);cvd2 = padarray(cvd2,k k,1,post);cdd2 = padarray(cdd2,k k,1,post);A2= A3,chd2*4; cvd2*4,cdd2*4;k=s(2,1)*4-s(4,1);chd1 = padarray(chd1,k k,1,post);cvd1 = padarray(cvd1,k k,1,post);cdd1 = padarray(cdd1,k k,1,post);A1 = A2,chd1*4; cvd1*4,cdd1*4;subplot(122),imshow(A1,InitialMagnification,100);title(三级小波分解后图像);