フィルターのクリア

Error in using waverec2

2 ビュー (過去 30 日間)
kash
kash 2013 年 2 月 28 日
I have a code below,where i used 2 level decomposition and added noise to image ,wen reconstructing i am not getting original image ,please assist
X = imread('cameraman.tif');
[C,S] = wavedec2(X,2,'haar');
A1 = appcoef2(C,S,'haar',1);
A2 = appcoef2(C,S,'haar',2);
[H1,V1,D1] = detcoef2('all',C,S,1);
[H2,V2,D2] = detcoef2('all',C,S,2);
lev=[A1,H1;V1,D1];
figure('name','One_level_Decomposition','numbertitle','off'), imshow(uint8(lev))
q=[A2,H2;V2,D2];
q1=[q,H1;V1,D1];
figure('name','Two_level_Decomposition','numbertitle','off'), imshow(uint8(q1)),title('Two_level_Decomposition')
J = imnoise(q1,'salt & pepper',0.02);
G=J(:)';
p=waverec2(G,S,'haar')

採用された回答

Wayne King
Wayne King 2013 年 2 月 28 日
You add noise to the image, then denoise in the wavelet domain, then reconstruct.
Like this:
load sinsin;
Y = X + 18*randn(size(X));
[thr,sorh,keepapp] = ddencmp('den','wv',Y);
xd = wdencmp('gbl',Y,'sym4',2,thr,sorh,keepapp);
subplot(221)
imagesc(X); title('Original Image');
subplot(222);
imagesc(Y); title('Noisy Image');
subplot(223)
imagesc(xd); title('Denoised Image');

その他の回答 (2 件)

Wayne King
Wayne King 2013 年 2 月 28 日
Why do you expect that after you have added noise to the coefficients and then inverted the wavelet transform that you would obtain the original image?
That will never happen. The wavelet transform (like the Fourier transform) is an invertible transform. If you modify the coefficients (in the wavelet domain or in the Fourier domain) and then invert the transform, you will end up with a different signal (image).
  1 件のコメント
kash
kash 2013 年 2 月 28 日
ok wayne is it possible to reconstruct from this variable q1
q1=[q,H1;V1,D1];

サインインしてコメントする。


Wayne King
Wayne King 2013 年 2 月 28 日
Yes, but you don't need to use anything other than the C,S vectors
load woman;
[C,S] = wavedec2(X,2,'haar');
Xnew = waverec2(C,S,'haar');
max(max(abs(X-Xnew)))
You see perfect reconstruction
  3 件のコメント
kash
kash 2013 年 2 月 28 日
not perfect reconstruction,nearly 70% is enough
kash
kash 2013 年 2 月 28 日
SOMETHING LIKE THIS
by adding noise

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Analysis についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by