Q21Digital Image Processing
Question
Explain various image compression models and discuss transform coding in detail.
Answer
A massive architectural review of Image Compression models. Violently contrasts spatial redundancy, psychovisual redundancy, and details the mathematically dominant Transform Coding architecture (DCT) utilized in the JPEG standard.
A raw, uncompressed RGB image consumes a massive 24 Megabytes of RAM. Transmitting this over a network is computationally catastrophic. Image Compression is the rigorous mathematical discipline of violently crushing the file size while preserving structural integrity. The algorithm must aggressively hunt down and annihilate three strict types of data redundancy:
- 1. Coding Redundancy: Occurs when 8-bit codes are stupidly used for every pixel. It is annihilated using Variable-Length Algorithms (like Huffman Coding), which assign 2-bit codes to common colors.
- 2. Spatial (Inter-pixel) Redundancy: Pixels in an image are mathematically highly correlated (a blue sky pixel is surrounded by thousands of identical blue pixels). Run-Length Coding and Predictive Coding violently collapse this spatial repetition.
- 3. Psychovisual Redundancy: The human eye is biologically flawed. It cannot perceive tiny, high-frequency shifts in color. Lossy compression algorithms aggressively exploit this flaw by physically deleting mathematical data the eye cannot physically see.
Transform Coding is the absolute dominant mathematical architecture for Lossy Image Compression. It does not compress the image in the spatial domain. It violently shatters the image into a mathematical frequency domain where compression is vastly more aggressive. The core engine of the JPEG format is the Discrete Cosine Transform (DCT).
The Mathematical Execution Pipeline
- 1. Sub-Image Division: The massive image is rigidly chopped into thousands of tiny pixel blocks.
- 2. The Transform (DCT): The 2D DCT is executed on each block. The 64 spatial pixels are mathematically transformed into 64 frequency coefficients. The top-left coefficient (the DC component) represents the massive average brightness. The bottom-right coefficients represent microscopic high-frequency noise.
- 3. The Quantization Matrix (The Lossy Step): This is where the aggressive compression occurs. The 64 coefficients are mathematically divided by a highly rigid Quantization Matrix. The matrix is engineered to have massive numbers in the high-frequency zones. Dividing a small high-frequency coefficient by a massive number violently forces it to exactly zero. The psychovisual noise is completely annihilated.
- 4. Zig-Zag Scanning & Encoding: The remaining non-zero coefficients are extracted using a diagonal zig-zag scan, violently clustering all the remaining
0s together. Finally, Huffman Coding mathematically compresses the array, resulting in compression ratios exceeding 10:1 with almost zero perceptible loss of structural quality.
Worked Example on an 8x8 Block
Consider a smooth block of near-constant intensity (a patch of blue sky). Its DCT produces a large DC coefficient (e.g., 200) capturing the average brightness, with almost all 63 AC coefficients close to zero because there is negligible spatial variation. After quantization with a typical JPEG luminance quantization matrix (where high-frequency entries reach 90-100), all but a handful of the small AC coefficients round to exactly zero, and the zig-zag scan produces a run such as [200, -1, 0, 0, 0, ..., 0], which Huffman/run-length coding represents in only a few bytes instead of the 64 original coefficients. Contrast this with a highly textured block (foliage or fabric weave): its DCT spreads energy across many AC coefficients, so quantization zeroes out fewer of them, the zig-zag run is longer and less compressible, and the block consumes proportionally more bits. This demonstrates why JPEG compression ratios vary strongly with image content: smooth regions compress far more aggressively than high-frequency texture, which is also why JPEG artifacts (blockiness, ringing near edges) are most visible in detailed regions at low quality settings, since coarse quantization there discards genuinely significant AC coefficients rather than just noise.