MATLAB Answers

How to compress a sequence of images using haar compression algorithm?

1 view (last 30 days)
shikha mangal
shikha mangal on 18 Apr 2016
Answered: Walter Roberson on 18 Apr 2016
hii,i have to compress images to reduce their resolution so that the time of processing will be reduce. i have a code for compression for one image only but i have to compress the all frames of my folder. so please give the way to do this. So that i can read all the frames of the folder and silmultaneously can compress them and save them in an another folder. I am giving the code for single image compression below :-
clear;
close all;
image = imread('person200.jpeg');
input_image_used = im2double(image);
n=input('Enter the decomposition level : ');
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar');
[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);
figure(1),imshow(input_image_used);
title('Input image');
%subplot(1,2,2);
figure(2),imshow(xd);
title('Compressed image');
Please help me if anyone can, your help is much awaited and will be appreciated. thank you in advance.

Community Treasure Hunt

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

Start Hunting!