图像fft和wavelet变换矩阵和向量区别 dwt2和wavedec2联系

1.  对于小波变换,dwt2 :单级离散2维小波变换

wavedec2 :多级2-D小波分解

matlab中这两者联系是都能对图像进行小波分解,区别是dwt2是二维单尺度小波变换,只能对输入矩阵X一次分解。wavedec2是二维多尺度小波分解,对输入矩阵X进行N次分解。

经本人实验验证,若图像矩阵是2^n大小,wavedec2执行一次语句就是dwt2进行n次。

2.  图像矩阵形式进行变换和图像转变为向量形式进行变换,效果其实是一样的。

详情请参见具体代码:

img = imread('lena256.bmp');
img = double(img);
ft2 = fft2(img);
figure(1);
subplot(221);
imshow(ft2);
title('图(a)二维离散傅里叶变换语句实现');

N = 256;
F = fft(eye(N,N));
%F = real(F);
%figure(2);
subplot(222);
imshow(F);
title('图(b)一维傅里叶变换矩阵示意图');

%F1 = F';
ft1 = F*img*F';
%ft1 = ft1*F1;
%figure(3);
subplot(223);
imshow(ft1);
title('图(c)二维离散傅里叶变换矩阵形式实现');
%result = (ft1==ft2);
%isequal(ft1,ft2);

w = DWT(N);
%a=full(w);
DW1 = w*img*w';

figure(2);
subplot(321);
imshow(DW1);
title('小波变换矩阵实现示意图')

subplot(322);
imshow(full(w));
title('小波变换矩阵示意图')

%[cA,cD] = dwt(img,'sym8');
[c,s] = wavedec2(img,1,'haar');
%[c,s] = wavedec2(img,1,'sym8');
[cA,cH,cV,cD] = dwt2(img,'haar');
%[cA,cH,cV,cD] = dwt2(img,'sym8');

[cA1,cH1,cV1,cD1] = dwt2(cA,'haar');
[cA2,cH2,cV2,cD2] = dwt2(cA1,'haar');
[cA3,cH3,cV3,cD3] = dwt2(cA2,'haar');
[cA4,cH4,cV4,cD4] = dwt2(cA3,'haar');
[cA5,cH5,cV5,cD5] = dwt2(cA4,'haar');
[cA6,cH6,cV6,cD6] = dwt2(cA5,'haar');
%cA = [cA1,cH1;cV1,cD1];
cA5 = [cA6,cH6;cV6,cD6];
cA4 = [cA5,cH5;cV5,cD5];
cA3 = [cA4,cH4;cV4,cD4];
cA2 = [cA3,cH3;cV3,cD3];
cA1 = [cA2,cH2;cV2,cD2];
cA = [cA1,cH1;cV1,cD1];
%cA = [cA1,]
subplot(323);
imshow(cA);
subplot(324);
imshow(cH);
subplot(325);
imshow(cV);
subplot(326);
imshow(cD);
figure(3)
subplot(321);
DW2 = [cA,cH;cV,cD];
imshow(DW2)
subplot(322);
c = reshape(c,256,256);
imshow(c);

上一篇:FindWindow 查找窗口


下一篇:ML.NET教程之出租车车费预测(回归问题)