how to convert bpp(bits per pixel to compression ratio)?
이전 댓글 표시
e.g. let bpp is 0.1870....than what will be the compression ratio?
답변 (1개)
Walter Roberson
2015년 5월 10일
0 개 추천
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
tina jain
2015년 5월 10일
tina jain
2015년 5월 10일
Walter Roberson
2015년 5월 10일
편집: Walter Roberson
2015년 5월 10일
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
2015년 5월 10일
tina jain
2015년 5월 10일
Walter Roberson
2015년 5월 10일
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
2015년 5월 10일
Walter Roberson
2015년 5월 10일
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
2015년 5월 10일
편집: Walter Roberson
2015년 5월 10일
Walter Roberson
2015년 5월 10일
편집: Walter Roberson
2015년 5월 10일
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.)
카테고리
도움말 센터 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!