二维小波分析图像压缩 去掉高频部分,保留低频 2006-08-15 16:12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %二维小波分析图像压缩 去掉高频部分,保留低频 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load wbarb; subplot(2,2,1); image(X); colormap(map); title('原始图像'); axis square disp('原始图像大小'); whos('X') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %提取小波分解结构中的第一层低频系数和高频系数 [c,s]=wavedec2(X,2,'bior3.7'); ca1=appcoef2(c,s,'bior3.7',1); ca2=detcoef2('h',c,s,1); ca3=detcoef2('v',c,s,1); ca4=detcoef2('d',c,s,1); %%%%%%%%%对各个频率成分重构 a1=wrcoef2('a',c,s,'bior3.7',1); h1=wrcoef2('h',c,s,'bior3.7',1); v1=wrcoef2('v',c,s,'bior3.7',1); d1=wrcoef2('d',c,s,'bior3.7',1); c1=[a1,h1;v1,d1]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %显示分解后各频率成分信息 subplot(2,2,2); image(c1); axis square title('分解后低频和高频信息'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %图像压缩, 保留一层分解的低频信息ca1,显示 %对第一层信息进行量化 ca1=appcoef2(c,s,'bior3.7',1); ca1=wcodemat(ca1,440,'mat',0);%量化编码 ca1=0.5*ca1;%改变图像高度 subplot(2,2,3); image(ca1); colormap(map); axis square title('一次压缩'); disp('第一次压缩后的大小为'); whos('ca1') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %保留第二层分解低频信息 ca2=appcoef2(c,s,'bior3.7',2); ca2=wcodemat(ca2,440,'mat',0); ca2=ca2*0.25; subplot(2,2,4); image(ca2); colormap(map); axis square title('二次压缩'); disp('第二次压缩后的大小为'); whos('ca2')