Problem with wavelet decomposition-recosntruction
6 views (last 30 days)
Show older comments
I've performed 3 level transform on 'lena.gif' image using 'wavedec2' function, then I performed reconstruction using 'waverec2' function. The reconstructed image is saved by naming it as 'lena2.gif'. After that,I again perform 3- level decomposition on 'lena2.gif' image and found that the wavelet coefficient of 'lena.gif' and 'lena2.gif' differs in values!!.. Why this is happening? How can I solve this problem.
Thanks in advance.
0 Comments
Answers (1)
Wayne King
on 28 Aug 2011
Hi, you haven't told us whether you modified the coefficients at all before you reconstructed the image. Did you simply execute:
X = waverec2(C,S,'wname');
Did you verify that you had perfect reconstruction of the image in MATLAB?
Also, you have to take into consideration the class of the image before and after you create the gif file.
I suspect there were some differences introduced in the writing process. When you reread the new fig file in MATLAB, was it identical to the original? I'm guessing it wasn't and therefore the wavelet coefficients should not be the same.
For example:
load woman
[C,S] = wavedec2(X,3,'db2');
X1 = waverec2(C,S,'db2');
% verify perfect reconstruction
norm(X-X1,2)
Then if I write a new GIF file and read the data back in, the data will be in unsigned 8-bit integers.
imwrite(uint8(X1),'woman.gif','GIF')
newwoman = imread('woman.gif');
Now the data is uint8.
Wayne
See Also
Categories
Find more on Image Analysis 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!