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$
2
  • $\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$ Oct 23, 2017 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$ Nov 21, 2017 at 14:33

2 Answers 2

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$
1
  • $\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$ Nov 21, 2017 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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