Error in using waverec2

1 visualización (últimos 30 días)
kash
kash el 28 de Feb. de 2013
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')

Respuesta aceptada

Wayne King
Wayne King el 28 de Feb. de 2013
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');

Más respuestas (2)

Wayne King
Wayne King el 28 de Feb. de 2013
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 comentario
kash
kash el 28 de Feb. de 2013
ok wayne is it possible to reconstruct from this variable q1
q1=[q,H1;V1,D1];

Iniciar sesión para comentar.


Wayne King
Wayne King el 28 de Feb. de 2013
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 comentarios
kash
kash el 28 de Feb. de 2013
not perfect reconstruction,nearly 70% is enough
kash
kash el 28 de Feb. de 2013
SOMETHING LIKE THIS
by adding noise

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by