dwt2 function for image compression

1 Ansicht (letzte 30 Tage)
Izabela Bigos
Izabela Bigos am 17 Dez. 2022
Beantwortet: Harsh Sanghai am 20 Dez. 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')

Antworten (1)

Harsh Sanghai
Harsh Sanghai am 20 Dez. 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:

Kategorien

Mehr zu Wavelet Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by