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

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

N=3;
[CA,CH,CV,CD] = DWT2(input_ima,'bior2.2');
[C,S] = WAVEDEC2(CA,N,'bior2.2');
THR=20;
 [XC,CXC,LXC,PERF0,PERFL2] = WDENCMP('gbl',C,S,'bior2.2',N,THR,'s',1);
    X = WAVEREC2(CXC,LXC,'bior2.2');
    z = IDWT2(X,CH,CV,CD,'bior2.2')
    out=uint8(z);
    out1=imresize(out,[328,438]);
     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); %328x438 
    error=0;
  for y=1:438
     for x=1:328
        MSE=((input_ima1(x,y))-(out2(x,y)))^2;
        error=MSE+error;
      %  error_sbw1=error_sbw+MSE2;
     end
 end
 MSE_WO=(1/(328*438))*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,143664]);

va=var(in);
disp(va);
snr=10*log10(va/MSE_WO);
disp('signal to noise ratio');
 disp(snr);
%  
% 
% The compression ratio using WBC
%    90.3927
% 
% PSNR value for decompression image using wavelet compression only
%    38.6475
% 
% the time need to execute this WBC only
% 
% ans =
% 
%    10.2700
% 
%   8.9682e+003
% 
% signal to noise ratio
%    w

Contact us at files@mathworks.com