how the compression ratio is calculated

i have a code
X=imread(file);
wavelet='haar'
level=2;
[c,s] = wavedec2(X,2,wavelet);
alpha = 1.5; m = 2.7*prod(s(1,:));
[thr,nkeep] = wdcbm2(c,s,alpha,m)
[xd,cxd,sxd,perf0,perfl2] = wdencmp('lvd',c,s,wname,n,thr,'h');
disp('Compression Ratio');disp(perf0);
the size of xd and X is same,plz tell how compression ratio is calculated
both images look like same ,how we can say it is compressed ny 84%
perf0 is 84%

 채택된 답변

Wayne King
Wayne King 2012년 12월 24일

0 개 추천

perf0 is the percentage of zeros in the wavelet coefficients. So 84% indicates that 84 percent of the wavelet coefficients have been set to 0.
perfl2 is the ratio (as a percentage) between the L2 norm of the compressed wavelet coefficients and the original (before compression) wavelet coefficients.
Yes, the output compressed image is of course the same size as the input, the point is that it is constructed from a much smaller set of wavelet coefficients

댓글 수: 5

FIR
FIR 2012년 12월 24일
so can we tell that the image is compressed to 84%
Wayne King
Wayne King 2012년 12월 24일
yes, by that metric
FIR
FIR 2012년 12월 24일
편집: FIR 2012년 12월 24일
nnz(perf0) gives as 1
Wayne i sthere any compression that can make the image into smaller size,the code used me as of 3 to 4 lines as above,
Wayne King
Wayne King 2012년 12월 24일
perf0 is just a scalar, so why would you use nnz() on that and expect something other than a 1?
FIR
FIR 2012년 12월 24일
Wayne i sthere any compression that can make the image into smaller size, as of 3 to 4 lines as above,i tried huffman but matlab crashes

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Denoising and Compression에 대해 자세히 알아보기

질문:

FIR
2012년 12월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by