Path: news.mathworks.com!not-for-mail
From: "chetan sood" <chetan_mastnath@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: need help to understand wavelet image compression code, in matlab
Date: Wed, 29 Apr 2009 15:44:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <gt9sk1$jph$1@fred.mathworks.com>
Reply-To: "chetan sood" <chetan_mastnath@yahoo.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1241019841 20273 172.30.248.38 (29 Apr 2009 15:44:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 29 Apr 2009 15:44:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1817717
Xref: news.mathworks.com comp.soft-sys.matlab:536195


thank you in advance actually i am studying in btech electronics and communication and have undertaken a project to use wavelets to compress images, i searched a lot of codes online in an attempt to understand how to build a software to compress images . one of the code i am interested in is given below and i would like the help of brilliant  ppl who visit this forum . i hope some one would help me on this .

below is the code and i have put in my problems with it in comments . thank u again in advance

any explanation would be helpful as i am  a rookie in the field of matlab and wavelets



clear all;
close all;
image = imread('rice.png');
input_image_used = im2double(image); % why do we need double ????
n=input('Enter the decomposition level : ');
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar'); % what is the physical significance of the 
% 4 filters . 
[c,s]=wavedec2(input_image_used,n,Lo_D,Hi_D);
disp('The decomposition vector output is');
disp(c);
disp('Size : ');
disp(s);
[thr,nkeep] = wdcbm2(c,s,1.5,3*prod(s(1,:)));
[xd,cxd,sxd,perf0,perfl2] = wdencmp('lvd',c,s,'haar',n,thr,'s');
disp('Compression ratio in percentage : ');
disp(perfl2);
subplot(1,2,1);
imshow(input_image_used);
title('Input image');
subplot(1,2,2);
imshow(xd);
title('Compressed image');