IMAGE ENCODER AND DECODER MODEL
Image Compression and Reconstruction
Based on Digital Image Processing by Gonzalez and Woods
Image Compression Encoder Decoder Lossless and Lossy1. Introduction
An Encoder and Decoder Model is an important concept in Digital Image Processing. It is used to reduce the amount of data required to represent an image and reconstruct the image when it is decoded.
A digital image contains a large amount of information. Image compression techniques reduce the data by removing different types of redundancy.
The encoder converts the original image into a compressed representation. The decoder uses the compressed information to reconstruct the image.
Compressed Data → Decoder → Reconstructed Image
According to Gonzalez and Woods, a general image compression system consists of three major encoding operations:
- Mapper
- Quantizer
- Symbol Coder
The corresponding decoder contains:
- Symbol Decoder
- Inverse Mapper
2. General Image Compression Model
The general model described by Gonzalez and Woods can be represented as follows.
Encoder Model
f(x,y) → Mapper → Quantizer → Symbol Coder → Compressed Data
Decoder Model
f̂(x,y)
3. Components of an Image Encoder
3.1 Mapper
The mapper converts the original image into a different representation to reduce spatial or interpixel redundancy.
It transforms the image into a format that is more suitable for compression.
Examples:
- Run-Length Coding (RLC)
- Differential Pulse Code Modulation (DPCM)
- Discrete Cosine Transform (DCT)
- Wavelet Transform
3.2 Quantizer
The quantizer reduces the precision of the mapped image values by assigning them to a limited set of representative levels.
It is used to remove psychovisual redundancy by reducing information that is less noticeable to the human visual system.
Example:
Quantized Value = 120
The difference between the original and quantized value is the quantization error.
e = 127 - 120 = 7
3.3 Symbol Coder
The symbol coder converts the quantized values into binary codewords for efficient storage or transmission.
It reduces coding redundancy by assigning shorter codewords to frequently occurring symbols.
Examples:
- Huffman Coding
- Arithmetic Coding
- Variable-Length Coding
4. Components of an Image Decoder
4.1 Symbol Decoder
The symbol decoder converts the compressed binary codewords back into the corresponding quantized symbols.
It performs the reverse operation of the symbol coder.
4.2 Inverse Mapper
The inverse mapper converts the decoded representation back into the spatial image domain.
It performs the reverse operation of the mapper. For transform-based compression, it applies the corresponding inverse transform.
Examples:
- Inverse DCT
- Inverse Wavelet Transform
- Inverse Predictive Mapping
- Reconstruction of image blocks
5. Channel Encoder and Channel Decoder
In an image transmission system, the compressed data may pass through a communication channel.
To protect the compressed data from transmission errors, additional channel coding can be applied.
Channel Encoder
Adds redundancy to the compressed bitstream to help detect or correct errors during transmission.
Channel
The medium through which the data is transmitted, such as a wireless network, optical fibre or storage link.
Channel Decoder
Uses the added redundancy to detect or correct transmission errors before the image compression decoder processes the compressed data.
6. Lossless and Lossy Compression Models
6.1 Lossless Compression
In lossless compression, the reconstructed image is exactly the same as the original image.
The quantizer is omitted because no image information should be discarded.
Examples:
- Huffman Coding
- Run-Length Coding
- LZW Coding
6.2 Lossy Compression
In lossy compression, some information is discarded during quantization to achieve a higher compression ratio.
Examples:
- JPEG compression
- Transform Coding with Quantization
- Wavelet-based lossy compression
7. Step-by-Step Numerical Example
Consider a simple grayscale image represented by the following pixel values:
Step 1: Original Image
| 120 | 125 | 128 | 135 |
|---|---|---|---|
| 140 | 145 | 150 | 155 |
Step 2: Mapping Operation
For illustration, consider a simple mapping operation that calculates the difference between consecutive pixel values in a row.
For the first row:
Mapped Values:
120, 5, 3, 7
For the second row:
Mapped Values:
140, 5, 5, 5
| 120 | 5 | 3 | 7 |
|---|---|---|---|
| 140 | 5 | 5 | 5 |
The differences are much smaller than many of the original pixel values. This can make subsequent compression more effective.
Step 3: Quantization
Assume a simple quantizer with step size Δ = 4. For this example, quantization is performed using:
Quantization calculations:
| Mapped Value | Calculation | Quantized Value |
|---|---|---|
| 120 | round(120/4) | 30 |
| 5 | round(5/4) | 1 |
| 3 | round(3/4) | 1 |
| 7 | round(7/4) | 2 |
| 140 | round(140/4) | 35 |
| 5 | round(5/4) | 1 |
| 5 | round(5/4) | 1 |
| 5 | round(5/4) | 1 |
Step 4: Symbol Coding
The quantized symbols can now be represented using binary codewords.
| Symbol | Example Codeword |
|---|---|
| 1 | 0 |
| 2 | 10 |
| 30 | 110 |
| 35 | 111 |
The resulting illustrative compressed bitstream is:
Step 5: Decoding
The decoder reverses the operations:
- Symbol decoder recovers the quantized values.
- Inverse quantizer multiplies the values by 4 to obtain reconstructed differences.
- Inverse mapper adds the differences cumulatively to reconstruct the pixels.
Step 6: Reconstructed Values
First row:
1 × 4 = 4
1 × 4 = 4
2 × 4 = 8
Reconstruction:
120, 124, 128, 136
Second row:
1 × 4 = 4
1 × 4 = 4
1 × 4 = 4
Reconstruction:
140, 144, 148, 152
Original vs Reconstructed Image
| Original | Reconstructed |
|---|---|
| 120 | 120 |
| 125 | 124 |
| 128 | 128 |
| 135 | 136 |
| 140 | 140 |
| 145 | 144 |
| 150 | 148 |
| 155 | 152 |
8. Encoder Algorithm
IMAGE_ENCODER(Original_Image): 1. Read the original image. 2. MAPPED_DATA = MAPPER(Original_Image) 3. QUANTIZED_DATA = QUANTIZER(MAPPED_DATA) 4. COMPRESSED_DATA = SYMBOL_ENCODER(QUANTIZED_DATA) 5. Store or transmit COMPRESSED_DATA. 6. END
Decoder Algorithm
IMAGE_DECODER(Compressed_Data): 1. Read compressed data. 2. DECODED_SYMBOLS = SYMBOL_DECODER(Compressed_Data) 3. RECONSTRUCTED_IMAGE = INVERSE_MAPPER(DECODED_SYMBOLS) 4. Display reconstructed image. 5. END
9. Types of Redundancy Removed by Encoder
1. Coding Redundancy
Occurs when more bits are used than necessary to represent the information. Symbol coding reduces this redundancy.
2. Interpixel Redundancy
Neighbouring pixels often have similar intensity values. Mapping operations such as predictive coding help reduce this redundancy.
3. Psychovisual Redundancy
Some image information is less noticeable to human vision. Quantization can remove or reduce this information.
| Redundancy | Operation |
|---|---|
| Coding Redundancy | Symbol Coder |
| Interpixel Redundancy | Mapper |
| Psychovisual Redundancy | Quantizer |
10. Performance Measurement of Image Compression
Compression Ratio
For example, if an image requires 800 KB and the compressed image requires 200 KB:
Mean Squared Error (MSE)
MSE measures the average squared difference between the original and reconstructed image.
Peak Signal-to-Noise Ratio (PSNR)
For an 8-bit grayscale image, MAX = 255. A higher PSNR generally indicates lower reconstruction error.
11. Advantages of Encoder and Decoder Model
- Reduced Storage: Compressed images require less storage space.
- Faster Transmission: Smaller data can be transmitted more efficiently.
- Flexible Design: Different mapping and coding methods can be combined.
- Lossless Support: The model can preserve the exact original image.
- Lossy Support: It can achieve higher compression by controlling image quality.
- Efficient Processing: Each stage performs a specific operation.
- Wide Applications: Used in image storage, communication and multimedia systems.
12. Disadvantages of Encoder and Decoder Model
- Computational Cost: Some transformations and coding operations require significant processing.
- Quality Loss: Lossy quantization can introduce image distortion.
- Complexity: Advanced compression methods require more complicated encoding and decoding.
- Memory Requirements: Intermediate image representations may require additional memory.
- Encoding Time: Complex coding methods may increase processing time.
- Compatibility: Encoder and decoder must follow compatible compression formats and parameters.
13. Applications
- JPEG image compression.
- Digital photography and image storage.
- Medical image archiving and transmission.
- Satellite and remote sensing image transmission.
- Web image optimization.
- Video compression systems.
- Digital multimedia communication.
- Image databases and cloud storage.
14. Interactive Encoder and Decoder Demonstration
Enter grayscale pixel values and observe the operations of the encoder and decoder. This demonstration uses predictive mapping, scalar quantization and a simple illustrative symbol representation.
Step 1: Input Image Pixel Values
Enter eight grayscale values separated by commas.
Step 2: Select Compression Type
Step 3: Quantization Step Size
15. Conclusion
The Encoder and Decoder Model is the foundation of image compression in Digital Image Processing.
The encoder uses a mapper, quantizer and symbol coder to reduce the amount of data required to represent an image. The decoder uses symbol decoding and inverse mapping to reconstruct the image.
In lossless compression, the reconstructed image is identical to the original. In lossy compression, quantization reduces the data size at the expense of some image quality.
Understanding this model helps students understand JPEG, predictive coding, transform coding and other image compression techniques.
16. References and Study Materials
Primary Textbook:
Rafael C. Gonzalez and Richard E. Woods, Digital Image Processing, 3rd Edition, Prentice Hall, Chapter 8 – Image Compression.
📘 Reference 1: Gonzalez and Woods – Digital Image Processing, 3rd Edition 📗 Reference 2: Chapter 8 – General Image Compression Model 📙 Reference 3: Image Compression – Encoder and Decoder Block Diagram
No comments:
Post a Comment