i try to fing energy compaction ratio...please chk my code because i am little bit confuse about the formula of obtaining ECR
3 views (last 30 days)
Show older comments
image2=rgb2gray(imread('C:\Users\hp\Desktop\data\1 (4).JPG'));
wavemngr('del','josh');
wavemngr('add','shivjoshi','josh',1,'','newwavelet.m');
OUT1 = wavemngr('read');
[C,S] = wavedec2(image2,6,'josh');
thr=1.0000;
[Xcomp,CXC,LXC,PERF0,PERFL2] =wdencmp('gbl',C,S,'josh',6,thr,'h',1);
% colormap(map);
% subplot(1,2,1); image(K); title('Original Image');
% axis square
% subplot(1,2,2); image(Xcomp); title('Compressed Image');
% axis square
disp('The compression ratio is')
disp(PERF0)
disp('Retained Energy is')
disp(PERFL2)
K=image2;
Z=double(K);
W=double(Xcomp);
M=size(K,1);
N=size(K,2);
for y=1:N
for x=1:M
MSE=(1/(M*N))*((Z(x,y))-(W(x,y)))^2;
end
end
disp('PSNR value of decompressed image is');
PSNR=10*log10((255^2)/MSE);
disp(PSNR)
%ENERGY COMPACTION RATION
a=0;
variance=(var(Xcomp,0,1));
for i=1:size(variance,2)
a=a+variance(1,i);
end
ecr=a/length(variance)
0 Comments
Answers (0)
See Also
Categories
Find more on Denoising and Compression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!