dwt2 function for image compression

1 次查看(过去 30 天)
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')

回答(1 个)

Harsh Sanghai
Harsh Sanghai 2022-12-20
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:

类别

Help CenterFile Exchange 中查找有关 Wavelet Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by