clc,clear all,close all; load woman; %單尺度二維離散小波分解。分解小波函數haar [cA,cH,cV,cD]=dwt2(X,'haar'); %單尺度二維離散小波重構(逆變換) Y=idwt2(cA,cH,cV,cD,'haar'); figure; subplot(1,2,1),imshow(X,map),title('原始圖像'); subplot(1,2,2),imshow(Y,map),title('重構圖像');
clear all;close all;clc; I=imread('C:\Users\Jv\Desktop\wenli.jpg'); gray=I; X=double(gray); [cA,cH,cV,cD]=dwt2(X,'haar'); %單尺度二維離散小波低、高頻重構(逆變換) a=idwt2(cA,[],[],[],'haar'); h=idwt2([],cH,[],[],'haar');v=idwt2([],[],cV,[],'haar');d=idwt2([],[],[],cD,'haar'); figure; subplot(1,2,1),imshow(uint8(X)),title('原圖'); subplot(1,2,2),imshow(uint8(a)),title('低頻重構圖'); figure; subplot(1,3,1),imshow(uint8(h)),title('水平高頻重構圖'); subplot(1,3,2),imshow(uint8(v)),title('豎直高頻重構圖'); subplot(1,3,3),imshow(uint8(d)),title('對角高頻重構圖');