how to convert bpp(bits per pixel to compression ratio)?
Afficher commentaires plus anciens
e.g. let bpp is 0.1870....than what will be the compression ratio?
Réponses (1)
Walter Roberson
le 10 Mai 2015
0 votes
That depends upon the original image. Most images in common use are 8 bits (uint8) per color component, 3 color components per pixel, so 24 total bits per pixel. If you had 0.1870 bits per pixel instead, your compression ratio would be 24:0.1870 or about 128.3 to 1
Some kinds of image have only 1 color pane, and some kinds of images use more or fewer bits per component.
imfinfo() can be used to extract information about an image file. In particular look at the Bitdepth field.
11 commentaires
tina jain
le 10 Mai 2015
tina jain
le 10 Mai 2015
Walter Roberson
le 10 Mai 2015
Modifié(e) : Walter Roberson
le 10 Mai 2015
bitdepth / bpp
With a bitdepth of 8, you are probably working with a grayscale image. Just be careful when you write your compression code that if you handle a color image, the bits per pixel calculation has to take into account the 3 color planes.
tina jain
le 10 Mai 2015
tina jain
le 10 Mai 2015
Walter Roberson
le 10 Mai 2015
Compression ratios are traditionally expressed as (for example) 4:1 to mean 4 bytes became 1 byte, that the output is 1/4 of the original. As your bpp is going to decrease if you do a good job compressing, your bpp is going to be at most bitdepth, so bpp/bitdepth would be less than 1. That would give you the fraction output size (for example 1 bit per pixel used instead of 8 bits per pixel would give an output 1/8 of the original) but it would not be in traditional ratio format, which would be 8:1 in this example.
tina jain
le 10 Mai 2015
Walter Roberson
le 10 Mai 2015
Yes, if the compression algorithm being used is not suitable for the data, then bpp can come out higher than bitdepth.
Every program that acts as a lossless compression routine on at least one input file must also cause at least one other input file to expand instead of getting shorter. This is a mathematical necessity. The trick is to find compression algorithms that compress files we are interested in. For example if an image compression program ended up expanding pictures of left-handed five-legged aardvarks, then we probably wouldn't care because we just don't get many of those in our world.
tina jain
le 10 Mai 2015
Modifié(e) : Walter Roberson
le 10 Mai 2015
Walter Roberson
le 10 Mai 2015
Modifié(e) : Walter Roberson
le 10 Mai 2015
To interpret that, we would need more information about what fileSize means here, and about what X is.
Note: I do not have the Wavelet Compression Toolbox to look at that code. (Do not post the file, though, it is proprietary.)
Catégories
En savoir plus sur Denoising and Compression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!