Image Compression Techniques Explained
Image Compression Techniques Explained
Huffman encoding achieves efficient data compression by creating Huffman codes which contain the smallest possible number of code symbols (bits) per source symbol or gray-scale level. This is done using a greedy algorithm to build Huffman trees by sorting probabilities and combining the two lowest probability elements into a parent node. Each left turn in the tree stores a 1 and each right turn a 0, resulting in variable length codes that minimize the average number of bits per pixel. Huffman codes are both instantaneous and uniquely decodable, enabling compression without loss of information .
The justification for using lossy image compression lies in its significant ability to reduce data size while maintaining an image quality that is often perceptually indistinguishable from the original to human viewers. Lossy compression effectively increases storage and transmission efficiency, which is crucial for handling large image datasets, streaming, and limited bandwidth scenarios. The errors introduced are often strategically localized in less visually important components of the image, minimizing noticeable quality loss while maximizing compression benefits .
Interpixel redundancy refers to the redundancy that arises because neighboring pixels in an image are often correlated, containing similar or predictable intensity levels. This redundancy can be reduced by representing the image based on the differences between pixel values rather than the absolute values, which helps in compressing the data. Techniques that exploit interpixel redundancy contribute to more compact representations of the image, increasing the efficiency of image compression .
The primary limitation of the Huffman algorithm is that, while it provides an efficient localized optimal solution for encoding based on the frequencies of source symbols, it does not guarantee a globally optimal compression ratio under all circumstances. This is due to its greedy nature, which might lead to suboptimal decisions that do not align with the best possible global compression. Additionally, Huffman coding does not exploit interpixel or psychovisual redundancies, potentially leaving further compression opportunities untapped .
The compression ratio in image compression is a measure of the effectiveness of a compression algorithm in reducing the data size of an image. It is calculated as the ratio of the original image size (n1) to the compressed image size (n2), expressed as CR = n1/n2. A higher compression ratio indicates a greater reduction in data size, which is desirable for storage and transmission efficiency .
Coding redundancy involves reducing the number of bits required to represent image data by taking advantage of statistical probabilities of pixel values, akin to choosing efficient data codes like Morse code. Psychovisual redundancy, on the other hand, involves the removal of visually less important data based on human perception, resulting in quantization. While coding redundancy can lead to lossless compression, psychovisual redundancy inherently leads to lossy compression due to irreversible data elimination .
The process of Huffman decoding involves navigating a Huffman tree using the encoded bitstream to retrieve the original symbols corresponding to each bit pattern. The main advantage is that it allows efficient and unique decoding, as the Huffman code is both instantaneous and uniquely decodable. This property ensures that each codeword can be interpreted without ambiguity and without needing to look ahead in the bitstream, streamlining the decoding process and preserving data integrity .
In the image compression pipeline, the symbol coder is responsible for converting image data into a stream of symbols using an efficient coding scheme, such as Huffman coding, which minimizes the number of bits used. The symbol decoder performs the reverse operation, converting the encoded symbols back into the original or approximate image data. This process is crucial for reducing the size of the image data during storage or transmission and then accurately retrieving it when needed .
In image compression, psychovisual redundancy is addressed by exploiting the human eye's lower sensitivity to certain visual information. Quantization is used to map a broad range of input values to fewer output values, thereby discarding less important information. This process, however, leads to lossy compression as it is irreversible. While quantization significantly reduces the data size, it can introduce distortions in the reconstructed image that may affect perceived image quality, especially at higher compression levels. The challenge is to balance compression efficiency with acceptable quality loss .
Lossless image compression reduces the image data size without any loss of information, enabling the exact original image to be reconstructed from the compressed data. It is achieved by reducing coding redundancy. In contrast, lossy image compression reduces the data size by removing psychovisual data deemed less important by human perception, resulting in some level of distortion and an irreversible loss of information. Therefore, in lossless compression, quality is preserved while in lossy compression, there is a trade-off between compression efficiency and image quality .