Information is the meaning conveyed by a message. Data is the container used to store or transmit it.
- Information is not compressible, since its meaning doesn’t change with the medium
- Data is compressible, since data capacity can exceed the information it carries
Image compression exploits 3 types of redundancy.
- Coding redundancy
The coding scheme uses more space than the information requires, e.g. an 8bpp image stored in 16bpp format. - Interpixel redundancy
Pixel values are correlated locally, e.g. a monotonous background or a repeating texture. - Psychovisual redundancy
Image detail that isn’t visually perceivable.
Coding Redundancy
Reduced by assigning shorter codewords to more probable grey levels. The lower bound on the average bits per pixel is the entropy of the image. Codeword allocation schemes are covered in image encoding.
Interpixel Redundancy
Correlated or repeating pixel patterns, such as texture or constant regions, can be represented more compactly than as independent pixel values.
Delta Coding
Transforms pixels into differences from a neighbour:
Here:
- : grey level at column and row
- : difference between a pixel and its right neighbour
The first pixel of each row has no left neighbour, so it is stored unchanged. The decoder rebuilds the row by accumulating the differences:
- Differences are typically small integers, since local pixels are correlated
- The difference histogram peaks sharply at 0, so its entropy is lower than the entropy of the raw grey levels
- Reduces correlation among pixel values, increasing coding efficiency
- Lossless, since the accumulation recovers every pixel exactly
Example:
- Row is stored as
Image Pyramid Coding
Each layer stores the difference from the layer above, upscaled to match resolution. Removes correlation relative to the previous layer.
The image is repeatedly smoothed and downsampled to build layers of decreasing resolution:
Each layer is predicted by upscaling the next coarser layer. Only the prediction error is stored:
The coarsest layer is stored as is. The decoder starts there and works down to full resolution:
Here:
- : original image
- : image at level , with the full-resolution image
- : index of the coarsest level
- : smoothing followed by downsampling by 2 in each dimension
- : upsampling by 2 in each dimension with interpolation
- : difference layer at level
Difference layers are mostly near 0 in smooth regions, so they have low entropy. The total number of samples is about of the image size, since each level has the samples of the one below. Compression comes from the lower entropy per sample.
Used for progressive image transmission, updating the receiver incrementally. The receiver shows first, then sharpens it as each arrives.
Run-Length Coding
Encodes a run of identical pixel values as pairs rather than storing each pixel separately. Pixels are scanned row by row, and a run normally ends at the end of a row.
A run of pixels, with bits per value and bits per count, saves space iff:
- Short runs can take more space than the raw pixels, so isolated pixels are a worst case
- More effective on binary images, which more often contain large regions of constant value
- In a binary image, runs alternate between 0 and 1. Only the first value and the run lengths need to be stored.
Example:
- Row is stored as
Bit-Plane Coding
Separates an -bit grey level image into binary bit-planes:
Here:
- : bit of the pixel at , with the least significant bit
Plane is the binary image formed by over all pixels.
- Lower order planes capture minor grey level changes
- Higher order planes capture larger changes, and hold larger regions of constant value
- Higher order planes compress better with schemes such as run-length coding
A small grey level change can flip many bits in the natural binary code, e.g. and differ in all 8 bits. This breaks runs in every plane. Gray code representation avoids it, since consecutive grey levels differ in exactly 1 bit:
The decoder recovers the original bits from the top plane downwards:
Here:
- : bit of the Gray coded pixel
- : exclusive OR
Psychovisual Redundancy
Not all image detail is equally perceivable. Removing imperceptible detail doesn’t affect apparent quality, but always loses information.
- Re-quantizing with lower grey level depth
- Smoothing to remove noise and minor variations before coding