4
$\begingroup$

So, I use the following code to carry out the discrete wavelet transform on an image of Lena. I am interested in then doing some changes to a single image out of the obtained 4. How do I extract any of the images? How do I then put it back into an object which I can then carry out the inverse wavelet transform on?

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

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

WaveletImagePlot[dwd, Automatic,ImageAdjust[ImageAdjust[#], {0.01, 0.2, 1.9}]&]

enter image description here

$\endgroup$
  • $\begingroup$ Did you look at the "Properties and Relations" section of the docs for WaveletImagePlot[]? It's explained there how to obtain separate images instead of a hierarchical grid. $\endgroup$ – J. M. is away Oct 23 '17 at 15:41
  • $\begingroup$ I must have missed it. Thank you @J.M., I have looked into now and realized that I missed it. $\endgroup$ – user3318424 Nov 21 '17 at 14:33
2
$\begingroup$

As I noted in the comments, the docs mention how to obtain the component images used in WaveletImagePlot[]:

img = ExampleData[{"TestImage", "Lena"}];
dwd = DiscreteWaveletTransform[img, HaarWavelet[], 2];

dwd[Automatic, "Image"]

component images

I'm not sure how to apply ImageAdjust[] to these component images to be consistent with the result of WaveletImagePlot[], however.

$\endgroup$
0
$\begingroup$

Why not use ImageTake?

img = ExampleData[{"TestImage", "Lena"}];
dwd = DiscreteWaveletTransform[img, HaarWavelet[], 2];
wip = WaveletImagePlot[dwd, Automatic,ImageAdjust[ImageAdjust[#], {0.01, 0.2, 1.9}] &]

ImageTake[wip, {20, 300}, {20, 300}]

which gives:

lena

$\endgroup$
  • $\begingroup$ Thank you for helping me out here @JeRut. This allows me to extract the parts I am interested in carrying out any processing on. Still the question remains, after doing the processing, how do I put that processed part of the image back and get its inverse DWT? $\endgroup$ – user3318424 Nov 21 '17 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.