image compression coefficients magnitude order

1 view (last 30 days)
Hello
I applied a Discrete Wavelet Transform (DWT) to a RGB image, for compression (code below).
I wish to plot the fact that only few of DWT coefficients have a large amplitude, after running the DWT. Specifically, I wish to plot the DWT coefficients in a sorted order of magnitude, so to show that a threshold on their value does not impact the quality of the compressed image.
Could someone please help out with plotting the coefficients magnitude in a sorted order? Not aware of any existing function which can do so, is there any? I enclose a sample reference plot, that is ideally what to expect.
Finally, if you can support a similar request but for a Fourier transform (displaying coefficients in descending order) that would be most useful, any suggestion most welcome.
Thanks a lot.
input_image1=imread('car.JPG');
n=input('enter the decomposition level=');
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar');
[c,s]=wavedec2(input_image,n,Lo_D,Hi_D);
% [THR,NKEEP] = wdcbm2(C,S,ALPHA,M)
[thr,nkeep] = wdcbm2(c,s,1.5,3*prod(s(1,:)));
% [XD,TREED,PERF0,PERFL2] = wpdencmp(X,SORH,N,'wname',CRIT,PAR,KEEPAPP)
[compressed_image,TREED,comp_ratio,PERFL2] =wpdencmp(input_image,'s',n,'haar','threshold',5,1);
disp('comp_ratio = '), disp(comp_ratio);
disp('size of decomposition vector = '), disp(size(c));
re_ima1 = waverec2(c,s,'haar');
re_ima=uint8(re_ima1);
subplot(1,3,1);
imshow(input_image);
title(original');
subplot(1,3,2);
imshow(compressed_image/156);
title('compressed');
subplot(1,3,3);
imshow(re_ima);
title('reconstructed');

Answers (0)

Community Treasure Hunt

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

Start Hunting!