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

Db1.m
%IMAGE COMPRESSION USING WAVELET TRANSFORM
clear all;
close all;
t=cputime; 
input_ima=imread('cell.tif');

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

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

% The compression ratio using WBC
%    88.7588
% 
% PSNR value for decompression image using wavelet compression only
%    33.4990
% 
% the time need to execute this WBC only
% 
% ans =
% 
%     4.2900
% 
%   206.3347
% 
% signal to noise ratio
%     8.5140

Contact us at files@mathworks.com