How can I reconstruct a color image to get its original version using wavelet?

2 views (last 30 days)
Wavelet is considered to be completely invertible. That is if an image is decomposed using wavelet. then the image can be get back by reconstructing it.
I am trying with this code for an color image. I perform selective reconstruction and then perform addition of those reconstructed details. But failing to recover completely the original image .
Please provide me with some suggestions or some code in matlab.
code :
I=imread('mouse.jpg'); %I=rgb2gray(I); %I=randn(256,256);
[Lo_D,Hi_D,Lo_R,Hi_R]=wfilters('db8');
[C,S]=wavedec2(I,2,Lo_D,Hi_D);
LF1=wrcoef2('a',C,S,'db8',1);
LF2=wrcoef2('a',C,S,'db8',2);
HHF1=wrcoef2('h',C,S,'db8',1);
VHF1=wrcoef2('v',C,S,'db8',1);
DHF1=wrcoef2('d',C,S,'db8',1);
HHF2=wrcoef2('h',C,S,'db8',2);
VHF2=wrcoef2('v',C,S,'db8',2);
DHF2=wrcoef2('d',C,S,'db8',2);
LF1=wcodemat(LF1,192); HHF1=wcodemat(HHF1,192); VHF1=wcodemat(VHF1,192); DHF1=wcodemat(DHF1,192);
LF2=wcodemat(LF2,192); HHF2=wcodemat(HHF2,192); VHF2=wcodemat(VHF2,192); DHF2=wcodemat(DHF2,192);
figure(1); title('low pass') subplot(2,4,1); imshow(uint8(LF1)); title('A1'); %axis image; % Display equal on x and y axes %axis off;
subplot(2,4,2); imshow(uint8(HHF1)); title('H1');
subplot(2,4,3); imshow(uint8(VHF1)); title('V1');
subplot(2,4,4); imshow(uint8(DHF1)); title('D1');
subplot(2,4,5); imshow(uint8(LF2)); title('A2');
subplot(2,4,6); imshow(uint8(HHF2)); title('H2');
subplot(2,4,7); imshow(uint8(VHF2)); title('V2');
subplot(2,4,8); imshow(uint8(DHF2)); title('D2');
%summatiomn L1=uint8(LF1); H1=uint8(HHF1); V1=uint8(VHF1); D1=uint8(DHF1);
result=L1+H1+V1+D1;
figure(2),imshow(result),title('Recovered image from L1,H1,V1,D1');
imwrite(result,'recover1.jpg','jpg');
%summatiomn L2=uint8(LF2); H2=uint8(HHF2); V2=uint8(VHF2); D2=uint8(DHF2);
result2=L2+H2+V2+D2;
figure(3),imshow(result2),title('Recovered image from L2,H2,V2,D2');
figure(4),imshow(I),title('Original Image');

Answers (0)

Categories

Find more on Wavelet Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!