图像处理之小波变换

Matlab 小波变换

lean图像的行列应该满足2的幂次方

img  =  imread('lena.jpg');
img =rgb2gray(img);
img = double(img);

[ca1 ch1,cv1,cd1] = dwt2(img,'haar');
figure;
imshow([uint8(ca1),uint8(ch1);uint8(cv1),uint8(cd1)]);
title('first wavelet decomposition');

[ca2 ch2,cv2,cd2] = dwt2(ca1,'haar');
figure;
imshow([uint8(ca2),uint8(ch2);uint8(cv2),uint8(cd2)]);
title('second wavelet decomposition');

% restruct img
img_ca1 =  idwt2(ca2,ch2,cv2,cd2,'haar');
img_re = idwt2(img_ca1,ch1,cv1,cd1,'haar');
figure;
imshow( uint8(img_re));
title('wavelet restruct');

参考:

http://media.cs.tsinghua.edu.cn/~ahz/digitalimageprocess/chapter12/chapt12_ahz.htm

 

展开阅读全文

没有更多推荐了,返回首页