No BSD License  

Highlights from
Wavelet based image compression using segmentation

from Wavelet based image compression using segmentation by THAYAMMAL SUBBURAJ
The optimal wavelet function in wavelet based image compression system was examined using different

cmponly_lengthbiorth22.m
% PSNR value for decompression image using wavelet compression only
%    34.4303
clear all;
close all;
t=cputime; 
input_ima=imread('pout.tif');

N=3;
[CA,CH,CV,CD] = DWT2(input_ima,'bior3.3');
[C,S] = WAVEDEC2(CA,N,'bior3.3');
THR=20;
 [XC,CXC,LXC,PERF0,PERFL2] = WDENCMP('gbl',C,S,'bior3.3',N,THR,'s',1);
    X = WAVEREC2(CXC,LXC,'bior3.3');
    z = IDWT2(X,CH,CV,CD,'bior3.3')
    out=uint8(z);
    out1=imresize(out,[291,240]);
     disp('The compression ratio using WBC');

disp(PERF0);    
figure;
    imshow(out1);
    title('recons ima using wbc only');
    
input_ima1=double(input_ima);
    out2=double(out1);
    error=0;
  for y=1:240
     for x=1:291
        MSE=((input_ima1(x,y))-(out2(x,y)))^2;
        error=MSE+error;
      %  error_sbw1=error_sbw+MSE2;
     end
 end
 MSE_WO=(1/(291*240))*error;
 %MSE_SBW=(1/(256*256))*error_sbw1;
    
 disp('PSNR value for decompression image using wavelet compression only');
 PSNR_WO=20*log10(255/sqrt(MSE_WO));
 disp(PSNR_WO);
 
 diff_ima=imsubtract(input_ima1,out2);
figure;
imshow(diff_ima);
title('difference image');
disp('the time need to execute this WBC only'); 
cputime-t
in=imresize(input_ima1,[1,65536]);

va=var(in);
disp(va);
snr=10*log10(va/MSE_WO);
disp('signal to noise ratio');
disp(snr);
%

% 
% 
% The compression ratio using WBC
%    83.2093
% 
% PSNR value for decompression image using wavelet compression only
%    36.5160
% 
% the time need to execute this WBC only
% 
% ans =
% 
%     6.7000
% 
%   626.5784
% 
% signal to noise ratio
%    16.3549
% 
% The compression ratio using WBC
%    87.3583
% 
% PSNR value for decompression image using wavelet compression only
%    35.6232
% 
% the time need to execute this WBC only
% 
% ans =
% 
%     6.4800
% 
%   626.5784
% 
% signal to noise ratio
%    15.4621

Contact us at files@mathworks.com