如何只用小波变换的水平系数重建图像?

How to re-construct an image with just the horizontal co-efficient of wavelet transform?

我正在尝试仅使用平稳小波变换的水平系数重建输入图像。

[A,H,V,D ] = swt2(x,1,'sym4');

A = 0; V = 0; D = 0; %i am setting other co-efficents to zero since i am only intersted in the values of H %

Y = iswt2(A,H,V,D,'sym4') ; %this gives the following error below%

Error in iswt2/reconsLOC (line 153)
ca(sR,sC),ch(sR,sC,k),cv(sR,sC,k),cd(sR,sC,k), ...
Error in iswt2 (line 122) a = reconsLOC(a,h,v,d);

我该如何解决这个问题?

您省略了错误消息的第一行,这给出了问题所在的线索:

Index exceeds matrix dimensions.

问题是您不能只将矩阵设置为标量 0,您必须将 整个矩阵 设置为零,这样它仍然大小与 H 相同。这将起作用:

A(:) = 0;  % Fills every element of A with zero
V(:) = 0;
D(:) = 0;
Y = iswt2(A, H, V, D, 'sym4');