How do I calculate the following : Suppose we want to compress tiny images that are 10x10 pixels and each pixel is represented by four bytes (for Red, Green, Blue and transparency).
Suppose a codebook (centroids of K-Means) of size 1000 provides acceptable distortion.
Assuming that each image is compressed separately, and ignoring the encoding of the codebook, what is the compression ratio (uncompressed bit / compressed bits)?
Ignoring global compression parameters and encoding, and assuming we're keeping all pixels - each cluster (i.e. a color palette value) would be encoded as its cluster index.
For that we'll need 10 bits (covering up to 1024 values) for encoding each pixel in our new 1000 color palette.
Then, compared to our previous representation of 32 bits per pixel (4 bytes, one per color channel) we achieved a compression ratio of:
32 / 10 = 3.2