Confusion whether the calculated compression ratio is correct or not.

I am applying compression on an image of 40KB(350x500x3 uint8) to get new image of 18KB(348x500x3 uint8) .I have used the following code for finding the compression ratio-
z='xyz.jpg';
z1='out.jpg';
k=imfinfo(z);
k1=imfinfo(z1);
ib=k.Width*k.Height*k.BitDepth/8;
cb=k1.Width*k1.Height*k1.BitDepth/8;
cr=ib/cb;
The value of cr comes to be 1.005747126436782 .
I don't know whether the value of cr is correct or not.Can anyone verify it? Also i would like to know how it is manually calculated via the formula.

3 件のコメント

Guillaume
Guillaume 2018 年 10 月 11 日
Depends on your definition of compression ratio.
I assume the byte sizes (40 kB vs 18 kB) you give are the file size (which will depend on storage format) whereas your formula compares the memory size (~525 kB vs ~522 kB).
Nidhi Kumari
Nidhi Kumari 2018 年 10 月 11 日
So what is the correct coding approach according to the byte size?
Walter Roberson
Walter Roberson 2019 年 7 月 30 日

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2018 年 10 月 11 日

コメント済み:

2019 年 7 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by