重建dwt2的3级子带

时间:2019-05-05 11:29:35

标签: matlab machine-learning dwt

我正在尝试重建在Matlab中进行3级DWT解构的图像。然后,我在第3级解构时向每个子带添加水印。

由于某种原因,当我重建图像时,它只是纯白色的,而输入图像是灰度图像。

这是我的matlab代码:

load watermark.mat
load Key.mat

image = imread('peppers.tif');
%imshow(image)
[LL1,HL1,HH1,LH1] = dwt2(image,'haar');
[LL2,HL2,HH2,LH2] = dwt2(double(LL1),'haar');
[LL3,HL3,HH3,LH3] = dwt2(double(LL2),'haar');

[wM,wN] = size(w);
%imshow(LL3)
alpha = 10;

for i = 1:wM
    row_number=key(i,1); column_number=key(i,2);
    coefficient_HL3=HL3(row_number,column_number);
    HL3(row_number, column_number) = coefficient_HL3 + (w(i)*alpha);

    coefficient_HH3=HH3(row_number,column_number);
    HH3(row_number, column_number) = coefficient_HH3 + (w(i)*alpha);

    coefficient_LH3=LH3(row_number,column_number);
    LH3(row_number, column_number) = coefficient_LH3 + (w(i)*alpha);
end

inverse_LL3 = idwt2(LL3,HL3,HH3,LH3, 'haar');
%imshow(inverse_LL3)
inverse_LL2 = idwt2(inverse_LL3,HL2, HH2, LH2, 'haar');
inverse_LL1 = idwt2(inverse_LL2,HL1, HH1, LH1, 'haar');
imshow(inverse_LL1);

如何重建图像以显示原始图像?

0 个答案:

没有答案