dwt2 function for image compression

2 visualizzazioni (ultimi 30 giorni)
Izabela Bigos
Izabela Bigos il 17 Dic 2022
Risposto: Harsh Sanghai il 20 Dic 2022
Hello, I'm supposed to use the following code for a project to transform the image "WeeksHallSmall.jpg", but I am so confused as to what I am supposed to input for X. I don't know if I need both imread and load as well. I am confused on where I need to add additional inputs, rather than what the MATLAB documentation supplied.
imread("WeeksHallSmall.jpg");
load 'WeeksHallSmall.jpg'
imagesc(X)
colormap gray
[LoD,HiD] = wfilters('haar','d');
[cA,cH,cV,cD] = dwt2(X,LoD,HiD,'mode','symh');
subplot(2,2,1)
imagesc(cA)
colormap gray
title('Approximation')
subplot(2,2,2)
imagesc(cH)
colormap gray
title('Horizontal')
subplot(2,2,3)
imagesc(cV)
colormap gray
title('Vertical')
subplot(2,2,4)
imagesc(cD)
colormap gray
title('Diagonal')

Risposte (1)

Harsh Sanghai
Harsh Sanghai il 20 Dic 2022
Hello Izabela,
For reading and displaying your own custom image "WeeksHallSmall.jpg" you can use the below code:
z = imread("WeeksHallSmall.jpg");
imagesc(z);
Note: imagesc(X) displays the data in array X as an image that uses the full range of colors in the colormap.
For understanding the "load" command use the below documentation as it is used to load ".mat" files:
For more information on dwt2 refer the documentation below:

Categorie

Scopri di più su Wavelet Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by