Import Data
The Wavelet Image Analyzer app can import an image from your workspace or a file. Load the xbox
image into your workspace.
Visualize Wavelet Decomposition
Open Wavelet Image Analyzer. On the Analyzer tab, click Import in the toolstrip. A window appears with a list of all the workspace variables that the app can process. Select xbox
and click Import. A four-level wavelet decomposition of the image appears and the app switches to the DWT tab. In the Scenarios pane, the decomposition is named xbox1
, and the method DWT
identifies the kind of decomposition. By default, the decomposition is obtained using the biorthogonal bior4.4
wavelet, which has four vanishing moments each for the decomposition and reconstruction filters.
The column titles in the Decompositions pane refer to the approximation (LL
) and details in three orientations: horizontal (LH
), vertical (HL
), and diagonal (HH
). The order of the pair of letters L
and H
indicates the order the lowpass (L
) scaling and highpass (H
) wavelet filters are applied to obtain the decomposition at successive levels. For more information about the 2-D DWT algorithm, see wavedec2
.
A checkbox in the Level Selection for Reconstruction pane controls whether to include those coefficients in the reconstruction. The Original-Reconstructed Image pane shows the original and reconstructed images.
To generate a new decomposition, change one of the wavelet parameters in the toolstrip:
Changing any parameter in the toolstrip enables the Decompose button. Click Decompose.
Compare Image Decompositions
You can create new decompositions of the same signal by clicking either the Add or Duplicate buttons in the Analyzer tab toolstrip. Changes you make to the wavelet parameters apply only to the selected scenario. Similarly, the coefficients you choose to include in the reconstruction apply only to the selected scenario. To compare decompositions or reconstructions, click the desired scenario in the Scenarios pane.
In the Analyzer tab, click Duplicate in the toolstrip. The scenario xbox1Copy
appears in the Scenarios panel. Both scenarios decompose the image using the bior4.4
wavelet. In the new scenario, change the wavelet to the Haar (db1
) wavelet and decompose. Form the reconstruction using all the coefficients except those corresponding to the diagonal (HH
) details.
Export Results
You can either export the image decomposition to your MATLAB™ workspace or generate a script to reproduce the results.
To generate a script to recreate the xbox1Copy
decomposition in your workspace, in the Analyzer tab, select Export ▼ > Generate MATLAB™ Script.
In the status bar, text appears stating that the script has been generated, and an untitled script opens in your editor with the executable code. You can save the script as is or modify it to apply the same decomposition settings to other images. To create the decomposition in your workspace, run the code. The script creates the workspace variable xbox1Copy_DWT
. The variable is a structure with the fields:
transformedImage
— This is the reconstructed image shown in the Original-Reconstructed Image pane.
decompositionCoefficients
— This field corresponds to the wavelet decomposition vector the wavedec2
function outputs.
bookkeepingMatrix
— This field corresponds to the bookkeeping matrix the wavedec2
function outputs.
If you instead chose to export the image decomposition, the same workspace variable xbox1Copy_DWT
is created in your workspace.
Note: If you import an image from a file and export its decomposition, the workspace variable has a fourth structure field, originalImage
, which contains the imported image.
Compare the original and reconstructed images.