0% found this document useful (0 votes)
14 views20 pages

Lossy vs. Lossless Image Compression

Image compression reduces file sizes while maintaining quality by removing redundant data through various algorithms. A typical compression system includes an encoder and decoder, with blocks for source and channel encoding to manage redundancies. Types of redundancies include coding, interpixel, and psychovisual, which can be exploited for efficient image storage and transmission.

Uploaded by

aryandake2004
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views20 pages

Lossy vs. Lossless Image Compression

Image compression reduces file sizes while maintaining quality by removing redundant data through various algorithms. A typical compression system includes an encoder and decoder, with blocks for source and channel encoding to manage redundancies. Types of redundancies include coding, interpixel, and psychovisual, which can be exploited for efficient image storage and transmission.

Uploaded by

aryandake2004
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

In digital image processing, image compression is the process of reducing the

file size of an image while maintaining its quality or, in some cases, sacrificing
some quality for a smaller file size. The basis of reduction process is removal of
redundant data. This is achieved through various algorithms that identify and
remove redundant or less important information, enabling efficient storage and
transmission.
 Why Compress?
Image files can be very large, especially high-resolution images. Compression
addresses this by reducing the storage space needed for images and the
bandwidth required for their transmission over networks.

Image Compression Model

Atypical image compression system comprises of two main blocks An Encoder


(Compressor) and Decoder (Decompressor). The image f(x,y) is fed to the
encoder which encodes the image so as to make it suitable for transmission. The
decoder receives this transmitted signal and reconstructs the output image
f(x,y). If the system is an error free one f(x,y) will be a replica of f(x,y).
The encoder and the decoder are made up of two blocks each. The encoder is
made up of a Source encoder and a Channel encoder. The source encoder
removes the input redundancies while the channel encoder increases the noise
immunity of the source encoders. The decoder consists of a channel decoder and
a source decoder. The function of the channel decoder is to ensure that the
system is immune to noise. Hence if the channel between the encoder and the
decoder is noise free, the channel encoder and the channel decoder are omitted.
Source encoder and decoder:
The three basic types of the redundancies in an image are interpixel, coding
redundancies and psychovisual redundancies. Run length coding is used to
eliminate or reduce interpixel redundancies Huffman encoding is used to
eliminate or reduce coding redundancies while I.G.S is used to eliminate
interpixel redundancies. The job of the source decoders is to get back the
original signal. The problem solved by runlength coding, Huffman encoding
and I.G.S coding are examples of source encoders and decoders.

The input image is passed through a mapper. The mapper reduces the interpixel
redundancies. The mapping stage is a lossless technique and hence is an
reversible operation. The output of a mapper is passed through a Quantizer
block. The quantizer block reduces the psychovisual redundancies. It
compresses teh data by eliminating some information and hence is an
irreversible operation. The quantizer block uses JPEG compression which
means a lossy compression. Hence in case of lossless compression, the
quantizer block is eliminated. The final block of the source encoder is that of a
symbol encoder. This block creates a variable length code to represent the
output of the quantizer. The Huffman code is a typical example of the symbol
encoder. The symbol encoder reduces coding redundancies.

The source decoder block performs exactly the reverse operation of the symbol
encoder and the mapper blocks. It is important to note that the source decoder
has only two blocks. Since quantization is irreversible, an inverse quantizer
block does not exist. The channel is noise free and hence have ignored the
channel encoder and channel decoder.
Channel encoder and decoder:
The channel encoder is used to make the system immune to transmission noise.
Since the output of the source encoder has very little redundancy, it is highly
susceptible to noise. The channel encoder inserts a controlled form of
redundancy to the source encoder output making it more noise resistant.
Redundancy means repetitive data.
In image processing, "redundancy" refers to the presence of unnecessary or
repetitive information that can be removed without significant loss of image
quality or content. This redundancy can be exploited for efficient image
compression and storage.
Types of Image Redundancy:
 Coding Redundancy:
This arises from the way images are encoded, where certain pixel values or
patterns occur more frequently than others. In this, redundancy refers
to unnecessary or repetitive code that doesn't contribute to the program's
functionality and can lead to inefficiencies, maintenance issues, and reduced
code quality.
What is Redundant Code?
 Unnecessary Repetition:
Redundant code involves repeating the same logic or operations in multiple
places within a program when a single, reusable implementation would suffice.
 Unused Code:
It can also include code that is never executed (dead code) or code that has no
external effect.
 Inefficiency:
Redundant code can lead to slower execution times and increased memory
usage.
 Maintenance Challenges:
Redundant code makes it harder to find and fix bugs, as developers have to
check multiple locations for the same functionality.
 Reduced Code Quality:
Redundant code is a sign of poor coding practices and can make the codebase
harder to understand and maintain.
Examples of Redundant Code:
 Recomputing Values:
Calculating the same value multiple times when it could be stored and reused.
 Duplicate Code Blocks:
Having the same code block in multiple functions or methods when a single
function or method could handle the logic.
 Unused Variables or Functions:
Declaring variables or functions that are never used in the program.
 Hardcoded Values:
Repeating the same values (like URLs or database names) throughout the code
instead of using constants or configuration files.
How to Identify and Eliminate Redundancy:
 Code Review: Have other developers review your code to identify
potential redundancies.
 Refactoring: Rewrite the code to remove redundancies and improve the
code structure.
 Use Functions/Methods: Encapsulate repetitive logic into functions or
methods to promote code reuse.
 Use Constants/Configuration Files: Store frequently used values in
constants or configuration files instead of hardcoding them.
 Static Analysis Tools: Use static analysis tools to automatically identify
potential redundancies.
 Interpixel Redundancy:
This refers to the correlation between neighboring pixels, where adjacent pixels
often have similar values or patterns. Interpixel redundancy in image
processing refers to the correlation or similarity between neighboring pixels in
an image, which can be exploited for efficient compression and storage.
Here's a more detailed explanation:
 What it is:
Interpixel redundancy arises because nearby pixels in an image often have
similar or related values, especially in areas with smooth gradients or constant
colors.
 Why it matters:
This redundancy means that not all pixel values are truly independent and can
be predicted from their neighbors. This predictability allows for compression
techniques that encode only the differences or "new" information between
pixels, rather than storing all pixel values individually.
 Psychovisual Redundancy:
This type of redundancy relates to how the human visual system perceives and
interprets images, where certain details or variations are less important or
noticeable than others.
Psychovisual redundancy refers to information in an image that the human
visual system doesn't perceive with the same sensitivity, and therefore can be
eliminated without significantly impacting image perception or quality.
Here's a more detailed explanation:
 The Human Visual System's Selective Processing:
The human eye and brain don't process all visual information equally. Certain
details, like subtle variations in brightness or color, are less important for overall
image understanding than others, such as edges or textures.
 Examples of Psychovisual Redundancy:
 Intensity Variations: The eye can perceive intensity variations
(like Mach bands) even in areas of constant intensity, indicating
that the brain doesn't process every pixel value with the same
attention.
 Color Differences: Humans are more sensitive to differences in
dark intensities than bright ones, and to high spatial frequencies of
green than red or blue.

Huffman Coding

Common questions

Powered by AI

Interpixel redundancy relates to the predictable relationships between neighboring pixels, while psychovisual redundancy pertains to variations less noticeable to human perception. Together, they support image compression by enabling the removal or reduction of unimportant data, ensuring that only critical visual information is retained. Interpixel redundancy is addressed using predictive coding techniques, while psychovisual redundancy allows for data reduction through quantization, optimizing both resource usage and perceived image quality .

Certain redundant information can be removed without significant loss in image quality because much of it does not significantly contribute to the visual experience. Interpixel redundancy, for example, involves predictable patterns between adjacent pixels, while psychovisual redundancy encompasses details less perceivable by human vision. Techniques such as run-length coding and quantization focus on removing these redundancies efficiently .

Ignoring the channel encoder and decoder in a noise-free environment could be problematic if any noise were to be introduced unexpectedly, as there would be minimal redundancy to correct errors. The channel encoder's role is to enhance noise immunity by adding redundancy; without it, even minor transmission errors could lead to significant image corruption due to the lack of error correction capabilities .

Maintaining a codebase with significant redundant code is challenging due to inefficiencies, increased potential for bugs, and difficulty in code management and updates. Developers can overcome these challenges by conducting regular code reviews, refactoring to eliminate redundancy, and utilizing tools to identify and rectify redundant sections. Encapsulating repetitive logic in functions or methods and using configuration files for recurring values are effective strategies to enhance the codebase's clarity and maintainability .

Huffman encoding reduces coding redundancies by creating a variable length code for the data, where frequently occurring pixel values are assigned shorter codes, and less common values receive longer codes. This ensures that the overall encoded image uses fewer bits than a uniform coding scheme, thereby optimizing data storage and transmission .

The human visual system's selective processing is significant in psychovisual redundancy because it allows certain image details to be omitted without noticeable loss of quality. The visual system does not process all details equally, prioritizing edges and textures over subtle color variations or intensity variations. Techniques that exploit psychovisual redundancy strip away information that has minimal impact on perceived image quality, facilitating effective image compression .

Interpixel redundancy can be exploited by using techniques that encode only the differences between neighboring pixels, rather than storing every pixel value independently. This method leverages the predictability of adjacent pixel values in areas with smooth transitions or constant colors, allowing for efficient image compression by focusing on changes or "new" information between pixels .

Eliminating redundant code is critical for improving code quality and maintenance because it ensures efficiency, reduces execution time, and minimizes memory usage. Redundant code can lead to inefficiencies, maintenance challenges, and is a sign of poor coding practices, making the codebase harder to understand and manage. By refactoring and using functions and constants, developers can streamline the code, making it easier to debug and extend .

The quantizer block in image compression reduces psychovisual redundancies by eliminating certain image details that the human visual system does not perceive as important. This reduces the amount of data but also introduces some loss of information, making the process irreversible. This means that, unlike lossless techniques, the original data cannot be fully reconstructed once quantization is applied, as less important details are permanently discarded .

Run-length coding is important for managing interpixel redundancies by compressing consecutive pixels with the same value into a single data entry, which is particularly effective in images with long runs of identical pixels, such as in binary images or images with large areas of uniform color. This reduces the volume of data needed to represent the image, enabling more efficient storage and transmission .

You might also like