dwt2 function for image compression

4 visualizaciones (últimos 30 días)
Izabela Bigos
Izabela Bigos el 17 de Dic. de 2022
Respondida: Harsh Sanghai el 20 de Dic. de 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')

Respuestas (1)

Harsh Sanghai
Harsh Sanghai el 20 de Dic. de 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:

Categorías

Más información sobre Wavelet Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by