# InverseWaveletTransform not recreating the original image exactly

I am trying to do DWT steganography. I first obtain the DiscreteWaveletTransform of the image as follows

dwd = DiscreteWaveletTransform[carrierImage, HaarWavelet[], 1]
(* Out: DiscreteWaveletData[<< DWT >>, < 1 >, {256, 256}] *)


This splits the image into four separate images that can be obtained with dwd[All, "Image"], but when I use those with InverseWaveletTransform I get a blurred version of the original image. Why is it so?

MWE to recreate the problem:

img = ExampleData[{"TestImage", "Lena"}];
dwd = DiscreteWaveletTransform[img, HaarWavelet[], 1];
newdwd = DiscreteWaveletData[dwd[All, "Image"], HaarWavelet[], DiscreteWaveletTransform];
Row[{
Show[InverseWaveletTransform[newdwd], ImageSize -> 200],
Show[InverseWaveletTransform[dwd], ImageSize -> 200]
}]


For @JasonB it's even worse (image link copied from his comment):

• @C.E. - I get a much worse reconstruction than you do: i.stack.imgur.com/RZuml.png – Jason B. Mar 14 '16 at 16:08
• @JasonB That's interesting, I added it to the question so it becomes even more intriguing at first glance. – C. E. Mar 14 '16 at 16:12
• You told the WaveletTransform to use a Haar wavelet. Which wavelet do you suppose the InverseTransfom is using? – bill s Mar 14 '16 at 16:19
• I've never reconstructed a DiscreteWaveletData object before. If you compare the files FullForm[dwd] >> "test1.txt"; FullForm[newdwd] >> "test2.txt"; you see that test1.txt is 889 lines longer... – Jason B. Mar 14 '16 at 16:19
• Every test I run returns that newdwd is not a properly constructed DiscreteWaveletData object. Try newdwd["TreeView"] and newdwd[All, "Image"] versus dwd["TreeView"] and dwd[All, "Image"]. Perhaps you could rephrase the question "How can I reconstruct a discrete wavelet data object from its constituent parts?" – Jason B. Mar 14 '16 at 16:30

## 1 Answer

The reason behind the blurry inverse transformations lies in the fact that a function (ImageAdjust) is applied to the wavelet coefficients when you call DiscreteWaveletData. And that's not what we want.

img = ExampleData[{"TestImage", "Lena"}];

dwd = DiscreteWaveletTransform[img, HaarWavelet[], 1];

newdwd = DiscreteWaveletData[
dwd[All, {"Image", "ImageFunction" -> Identity}], HaarWavelet[],
DiscreteWaveletTransform];

Row[{Show[InverseWaveletTransform[newdwd], ImageSize -> 200],
Show[InverseWaveletTransform[dwd], ImageSize -> 200]}]