0% found this document useful (0 votes)
7 views82 pages

Chapter 6

Chapter Six discusses image compression, focusing on the reduction of data size while maintaining image quality, and categorizes compression methods into lossless and lossy types. It covers various techniques such as Huffman coding, arithmetic coding, and run-length encoding, as well as the importance of data redundancy and information theory in compression. The chapter emphasizes the practical applications of image compression in storage efficiency and bandwidth reduction for internet transmission.

Uploaded by

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

Chapter 6

Chapter Six discusses image compression, focusing on the reduction of data size while maintaining image quality, and categorizes compression methods into lossless and lossy types. It covers various techniques such as Huffman coding, arithmetic coding, and run-length encoding, as well as the importance of data redundancy and information theory in compression. The chapter emphasizes the practical applications of image compression in storage efficiency and bandwidth reduction for internet transmission.

Uploaded by

surafel123emiru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Chapter Six: Image Compression

ØImage compression
ØData redundancy
ØElements of information theory
ØGeneral mechanism and types of data compression
ØHuffman coding
ØArithmetic coding
ØBit-plane coding
Image compression
§ It is the art and science of reducing the amount of data required to represent an
image.
§ Image compression involves reducing the size of image data files, while
retaining necessary information.
§ Retaining necessary information depends upon the application
§ The reduced file created by the compression process is called the
compressed file and is used to reconstruct the image, resulting in the
decompressed file .
§ The original image before any compression is performed, is called the
uncompressed image file.
§ The ratio of the original, uncompressed image file and the compressed file is
referred to as the compressed ratio.
Cont.…
§ Image compression is a process applied to a graphics file to minimize its size
in bytes without degrading image quality below an acceptable threshold.
§ By reducing the file size, more images can be stored in a given amount of disk
or memory space.
§ The image also requires less bandwidth when being transmitted over the
internet or downloaded from a webpage, reducing network congestion and
speeding up content delivery.
Data redundancy
§ The term data compression refers to the process of reducing the amount of
data required to represent a given quantity of information.
§ In this definition, data and information are not the same; data are the means
by which information is conveyed.
§ Because various amounts of data can be used to represent the same amount
of information, representations that contain irrelevant or repeated
information are said to contain redundant data.
§ Data compression implies sending or storing a smaller number of bits.
§ Although many methods are used for this purpose, in general these methods
can be divided into two broad categories: lossless and lossy
The same information can be represented by different data. i.e.
information and data are not the same.
Information vs Data
Data = Information + redundant data

Compression
• is a process of deriving more compact (i.e., smaller) representations of data.
• This compact representation is created by identifying and using structures that exist in the
data
Goal of Compression
• Significant reduction in the data size to reduce the storage/bandwidth Requirements
Strategies for Compression
• Reducing redundancies
• Exploiting the characteristics of human vision
Cont.…
§ If we let b and b′ denote the number of bits (or information carrying units) in
two representations of the same information, the relative data redundancy, R,
of the representation with b bits is

R =1-1/C
Where C, commonly called the compression ratio, is defined as
C = b/b’
Cont.….
Data redundancies can be classified into three:
§ Coding redundancy
§ Spatial and temporal redundancy
§ Irrelevant information or psychovisual redundancy
Data compression attempts to reduce one or more of these
redundancy types.
Coding redundancy
§ A code is a system of symbols (letters, numbers, bits, and the like) used to
represent a body of information or set of events.
§ Each piece of information or event is assigned a sequence of code symbols,
called a code word.
§ The number of symbols in each code word is its length.
§ The 8-bit codes that are used to represent the intensities in most 2-D intensity
arrays contain more bits than are needed to represent the intensities.
§ Assume that a discrete random variable rk in the interval [0,L -1] is used to
represent the intensities of an MxN image, and that each rk occurs with
probability pr(rk ).
Spatial and Temporal (interpixel) Redundancy
§ Interpixel redundancy implies that pixel values are correlated (i.e., a pixel
value can be reasonably predicted by its by its neighbors)
§ The pixels of most 2-D intensity arrays are correlated spatially (i.e., each
pixel is similar to or dependent upon neighboring pixels),
§ information is unnecessarily replicated in the representations of the correlated
pixels.
§ In a video sequence, temporally correlated pixels (i.e., those similar to or
dependent upon pixels in nearby frames) also duplicate information.
Irrelevant Information
§ Most images contain information that is ignored by the human visual system
and/or irrelevant to the intended use of the image.
§ Most 2-D intensity arrays contain information that is ignored by the human
visual system and/or extraneous to the intended use of the image.
§ It is redundant in the sense that it is not used.
Elements of information theory
Measuring Image Information
ØIn the previous sections, we introduced several ways to reduce the amount of data used to
represent an image.
ØThe question that naturally arises is: How few bits are actually needed to represent the
information in an image?
ØThat is, is there a minimum amount of data that is sufficient to describe an image without
losing information?
ØInformation theory provides the mathematical framework to answer this and related questions.
ØIts fundamental premise is that the generation of information can be modeled as a
probabilistic process which can be measured in a manner that agrees with intuition.
ØIn accordance with this supposition, a random event E with probability P(E) is said to contain
units of information.
Types of data compression techniques/methods
• Compression techniques are classified as:
1. Lossless methods (text or program)
2. Lossy methods (image, video, and audio)
§ If compression and decompression processes induce no information loss,
then the compression scheme is lossless; otherwise, it is lossy.
Lossless compression
§ As per its name, No data loss.
§ Reconstruct the original message exactly from the compressed message.
§ Generally used for files, spreadsheet files, important documents.
§ Some examples based on these techniques are RLE, Huffman Coding
RLE- Run Length Encoding
§ Simple compression technique.
§ Replace all consecutive number or alphabets by first the number of times an
alphabet was used followed by the alphabet itself.
§ This method becomes more effective with numbers especially when it is
output only two digits 1 and 0.
§ For example we have this stream below:
aaaabbbaabbbbbcccccccccdabcbaaabbbbbbbcccd
calculate the repetition
4a3b2a5b8c1d1a1b1c1b3a4b3c1d
Huffman Coding
§ Uses certain method for selecting representation for each symbol which gets certain code
which is called as huffman code.

§ in fact, assigns to symbols that occur and m to symbols occur


less in data.

§ It follows certain algorithm which is described below.

§ Make a base node for each code symbol

§ count their occurrences.


Example
§ For example, if we have a sentence like following

§ we exactly have to assign numbers to each symbol and count occurrences
§ by counting we can find 11 different symbols as follows
Lossy Compression
§ Unlike , this method by eliminating .

§ It can achieve very high compression ratios through data removal.

§ It could happen that if user try to decompose it, only a part of the original information is
still there.

§ This method is generally used for and where specific information loss is
there and that even not recognized by users.
Different Lossy Techniques

§ Comparatively, these methods are less time taking, cheaper as well as it can reduce more
space.

§ Methods based on lossy compression,

• JPEG: used for pictures and graphics

• MPEG: used for video compression

• Audio compression
Stages of JPEG compression
1. uncompressed picture
2. Picture preprocessing
3. image transformation
4. Quantization
5. Encoding
Cont....
Image preprocessing
- in this step, there is generation of an appropriate digital representation of the information in the
medium being processed.
Image transformation
- This step involves mainly the use of compression algorithm.
Quantization
- This step takes place after the data processing part. the values determined in the second part are
quantized according to specific properties like resolution.
Entropy Encoding
- in this, there is a data streaming of bits and bytes in a sequential way.
What is image compression?

§ Image compression is a process applied to a graphics file to minimize its size


in bytes without degrading image quality below an acceptable threshold.

§ By reducing the file size, more images can be stored in a given amount of disk or
memory space.

§ The image also requires less bandwidth when being transmitted over the internet or
downloaded from a webpage, reducing network congestion and speeding up content
delivery.
What are the two types of image compression?
§ The methods used to compress image files typically fall into one of two
categories:
– lossy and
– lossless
§ Lossy compression reduces an image file size by permanently removing
less critical information, particularly redundant data.
§ Lossy compression can significantly reduce file size, but it can also
reduce image quality to the point of distortion, especially if the image is
overly compressed.
Cont.…
§ One of the challenges with lossy compression is that it's irreversible.
§ Once it has been applied to an image, that image can never be restored to its
original state.
§ If lossy compression is applied repeatedly to the same image, it gets
increasingly distorted.
§ That said, lossy compression has proved to be a valuable strategy for the web,
where a moderate amount of image degradation can often be tolerated.
Cont.…
§ The most common example of lossy compression is JPEG, an image
compression format used extensively on the web and in digital photography.
§ This widely recognized format is supported by numerous tools and applications.
§ Additionally, compression can be applied in degrees, making it possible to use
JPEG compression that best strikes a balance between file size and quality.
Where JPEG = Joint Photographic Experts Group
Cont.…
§ The other approach to image compression is referred to as lossless.
§ This method applies compression without removing critical data or reducing
image quality and results in a compressed image that can be restored to its
original state with no degradation or distortion.
§ However, lossless compression doesn't reduce the file size nearly as much as
lossy compression, offering little advantage in terms of storage space, network
bandwidth or download speeds.
§ Lossless compression is generally used in situations where image quality is
more important than disk space or network performance, such as for product
images or to showcase artwork
Cont.…
§ One of the most common lossless formats is PNG, a widely used format that
reduces file size by identifying patterns and compressing those patterns
together.
§ Although PNG files are generally larger than JPEG files, websites use them
extensively when more image detail is needed, such as for logos, icons,
screenshots or images with text.
§ Another familiar lossless format is BMP, a proprietary approach to image
compression introduced by Microsoft and used primarily for Microsoft
products, particularly Windows computers.
Arithmetic coding
§ Arithmetic coding generates non-block codes.
§ In arithmetic coding, which can be traced to the work of Elias, a one-to-one
correspondence between source symbols and code words does not exist.
§ Instead, an entire sequence of source symbols (or message) is assigned a single
arithmetic code word.
§ The code word itself defines an interval of real numbers between 0 and 1.
§ As the number of symbols in the message increases, the interval used to represent it
becomes smaller, and the number of information units (say, bits) required to
represent the interval becomes larger.
§ Each symbol of the message reduces the size of the interval in accordance with its
probability of occurrence.
§ Because the technique does not require, as does Huffman’s approach, that each
source symbol translate into an integral number of code symbols (that is, that the
symbols be coded one at a time), it achieves (but only in theory) the bound
established by Shannon’s first theorem.
Bit-plane coding
§ The technique, called bit-plane coding, is based on the concept of
decomposing a multilevel (monochrome or color) image into a series
of binary images and compressing each binary image via one of
several well-known binary compression methods.
§ In this section, we describe the two most popular decomposition
approaches.
§ The intensities of an m-bit monochrome image can be represented in
the form of the base-2 polynomial Based on this property, a simple
method of decomposing the image into a collection of binary images
is to separate the m coefficients of the polynomial into m 1-bit bit
planes.
Cont.…
§ The lowest-order bit plane (the plane corresponding to the least significant bit)
is generated by collecting the a0 bits of each pixel,
§ while the highest-order bit plane contains the am-1 bits or coefficients.
§ In general, each bit plane is constructed by setting its pixels equal to the values
of the appropriate bits or
§ polynomial coefficients from each pixel in the original image.
§ The inherent disadvantage of this decomposition approach is that small
changes in intensity can have a significant impact on the complexity of the bit
planes.
§ If a pixel of intensity 127 (01111111) is adjacent to a pixel of intensity 128
(10000000), for instance, every bit plane will contain a corresponding 0 to 1
(or 1 to 0) transition.
Cont.…
§ For example, because the most significant bits of the binary codes for 127 and
128 are different, the highest bit plane will contain a zero-valued pixel next to
a pixel of value 1, creating a 0 to 1 (or 1 to 0) transition at that point.
§ An alternative decomposition approach (which reduces the effect of small
intensity variations) is to first represent the image by an m-bit Gray code.
§ The m-bit Gray code g m−1 …g2g1g0 that corresponds to the polynomial in can
be computed from
Cont.…
§ Here, denotes the exclusive OR operation.
§ This code has the unique property that successive code words
differ in only one bit position.
§ Thus, small changes in intensity are less likely to affect all m
bit planes.
§ For instance, when intensity levels 127 and 128 are adjacent,
only the highest-order bit plane will contain a 0 to 1
transition, because the Gray codes that correspond to 127
and 128 are 01000000 and 11000000, respectively.
! !! S i x
K S t e r
A N h a p
H
T of C
n d
e E n ?
T h t i o
e s
Q u
Chapter Seven: Color Image Processing
ØIntroduction
ØColor Fundamentals
ØColor Models (color space or color system)
ØBasics of Full-Color Image Processing
ØColor Transformations
Introduction
The use of color is important in image processing because:
vColor is a powerful descriptor that simplifies object identification and extraction.
vHumans can discern thousands of color shades and intensities, compared to about
only two dozen shades of gray.
vColor image processing is divided into two major areas:
§ Full color processing: images are acquired with a full color sensor, such as a color TV camera or
color scanner.
§ Pseudo color processing: The problem is one of assigning a color to a particular monochrome
intensity or range of intensities.
Color Fundamentals
vWhen color is available, it gives much more information about an image
than intensity alone.
vColor is very useful for recognition of objects in an image both for humans
and computers.
Color Fundamentals
Color Fundamentals
vThe actual color perceived by a human of an object depends on both the color
of the illumination and the reflectivity of the object, as well as the sensitivity of
human perception.
vObjects appear to be different colors because they absorb and reflect different
colors of light.
vA blue object, for example, reflects blue light while absorbing other colors.
vGrey objects or grey images reflect and absorb all frequencies of light about
equally, so they do not appear colored.
Color Fundamentals
vColors are seen as variable combinations of the primary colors of light:
Red(R), green (G), and blue(B).
vThe primary colors can be mixed to produce the secondary colors:
Magenta = red + blue
Cyan = green + blue
Yellow = red + green
vMixing the three primaries, or a secondary with its opposite primary color,
produces white light.
vColor is sensed by the eye using three kinds of cones, each sensitive primarily to
red, green or blue, though there is significant overlap.
Color Fundamentals
Color Fundamentals
vThe International Commission on Illumination in 1931, referred to red, green and
blue as the primary colors, and denote to set as RGB:
blue = 435.8nm
green = 546.1nm
Improved
red = 700nm analysis in
v Approximately: 1965
65% cones are sensitive to red
33% cones are sensitive to green
2% cones are sensitive to blue
(but the blue cones are most
sensitive)
Color Fundamentals

Additive color - emitted light

Subtractive color - reflected light


Characterization
Brightness, hue, and saturation
• Brightness: achromatic notion of intensity
• Hue: attribute associated with dominating wavelength in a mixture of light
waves, i.e., the dominant color perceived by observer
• Intensity (Value): associated with brightness
• Saturation: refers to the relative purity or the amount white light mixed with
a hue.
vHue, Saturation, and Intensity are making HSI or HSV color model
vHue and saturation together are called chromaticity.
Cont.…
vSo a color can be characterized by its brightness (intensity) and chromaticity
vThe amount of red, green and blue to form a particular color are called
tristimulus values, denoted by X, Y, Z.
vThese represent three dimensional coordinates of any perceived color.
vThe color is defined by
Cont.…
vThe tristimulus values can be normalized to give trichromatic coefficients, x
(red), y (green) and z (blue). Note that because of normalization: x + y + z = 1.
vSince x, y and z are not independent, only x and y are enough to specify a
color.
vIf the wavelength of the pure colors are plotted in these coordinates,
and the mixtures of these wavelengths are plotted inside the pure
colors, the result is known as the CIE (Commission Internationale de
l’Eclairage - International Commission on Illumination) chromaticity
diagram.
vIn the chromaticity diagram, white light is defined as the mixture of
equal amounts of all wavelengths of visible light.
Chromaticity Diagram

Color gamut: X (red)


The color range
produced by an RGB Y (green)
monitor
Z (blue) =
(1-(X+Y))

Color printing gamut


is irregular and more
limited
Color Models -- RGB Model
Color Models -- RGB Model
Color Models -- RGB Model
Color Models -- RGB Model
For most graphics
images used for
Internet applications, a
set of 216 colors has
been selected to
represent “safe colors”
which should be
reliably displayed on
computer monitors.
Color Models -- RGB Model
Color Models -- CMY and CMYK Models

An RGB to CMY conversion


 C  1  R 
 M   1  G 
    
 Y  1  B 
Color Models -- CMY and CMYK Models
Color Models -- HSI or HSV Model
Color Models -- HSI or HSV Model
Color Models -- HSI or HSV Model
Color Models -- HSI or HSV Model

• Converting colors from RGB to HIS


2 ( R  G )  ( R  B ) 
 if B  G  
   cos 
1
1
1 
H   ( R  G ) 2  ( R  B)(G  B) 
360   if B  G
2

3
S  1 min( R, G, B)
( R  G  B)

1
I  ( R  G  B)
3
Color Models -- HSI or HSV Model

• Converting colors from HSI to RGB


• Converting colors from HSI to RGB
– RG sector ( 0 o  H  120 o )
B  I (1  S )
 S cos H 
R  I 1  o 
 cos( 60  H ) 
G  3I  ( R  B )
– GB sector ( 120 o  H  240 o )
– BR sector ( 240 o  H  360 o )
Color Models -- HSI or HSV Model
The Basics of Color Image Processing
Three Principal Areas
1. Color Transformations:
Processing the pixels of each color plane based strictly on their values and not on their
spatial (neighborhood) coordinates.
It is similar to the grayscale image intensity transformations
2. Spatial Processing of Individual Color Planes:
Spatial filtering of each color planes is similar to the grayscale image spatial filtering.
3. Color Vector Processing
Processing all components of a color image simultaneously, where each pixel is
represented as a vector.
Color Transformations

• Extension of the gray level transformations to color space


• In theory any transformation can be done in any color space
• Some transformations are better suited for specific color spaces
• The cost of color space transformations must be considered
Color Transformations

g(x, y) = T[f(x, y)]


or
si = Ti(r1, r2,…,rn), i = 1, 2,…,n
where ri and si are color components of f(x, y) and g(x, y)
Color Transformations
Intensity transformation

g(x, y) = k f(x, y), 0 < k < 1


or
si = k ri, i = 1, 2,…,n

Intensity transformation on RGB modal: si = k ri , i = 1, 2, 3

Equivalent Transformation on other modals:


CMY: si = k ri + (1-k), i = 1, 2, 3
HSI: si = ri , i = 1, 2, s3 = k r3

The conversion calculations are more computationally intense than the intensity
transformation itself.
Color Transformations
Intensity transformation
Color Transformations
Intensity transformation
Color Transformations
Color Complements Transformation
• Identical to the gray-scale negative transformation.
• Complements are basically given by subtracting one color from white, or by changing
a hue by 180 degrees.
• Useful for visualization of image detail obscured by dark regions.
Color Transformations
Color Complements Transformation
! !! r
l o
l ap t e
H e h
ks e c
a n f t h
h
T nd o
e e
T h
Chapter 8: Object Recognition
Object Recognition
ØAn object recognition system finds objects in the real world from an image
of the world, using object models.
ØThis task is surprisingly difficult.
ØHumans perform object recognition effortlessly and instantaneously.
ØThe object recognition problem can be defined as a labeling problem based
on models of known objects.
ØThe object recognition problem is closely tied to the segmentation problem:
without at least a partial recognition of objects, segmentation cannot be done,
and without segmentation, object recognition is not possible.
Object Recognition
ØThe architecture and main components of object recognition and discuss
their role in object recognition systems of varying complexity.
System Component
An object recognition system must have the following components to perform
the task:
ØModel database (also called model-base)
ØFeature detector
ØHypothesizer
ØHypothesis verifier
Model Database
ØThe model database contains all the models known to the system.
ØThe information in the model database depends on the approach used for the
recognition.
ØIt can vary from a qualitative or functional description to precise geometric
surface information.
ØIn many cases, the models of objects are abstract feature vectors, as discussed
later in this section.
ØA feature is some attribute of the object that is considered important in
describing and recognizing the object in relation to other objects.
ØSize, color, and shape are some commonly used features.
Feature Detector
ØThe feature detector applies operators to images and identifies locations of features
that help in forming object hypotheses.
ØThe features used by a system depend on the types of objects to be recognized and the
organization of the model database.
ØUsing the detected features in the image, the hypothesizer assigns likelihoods to
objects present in the scene.
ØThis step is used to reduce the search space for the recognizer using certain features.
ØThe model-base is organized using some type of indexing scheme to facilitate
elimination of unlikely object candidates from possible consideration.
ØThe verifier then uses object models to verify the hypotheses and refines the
likelihood of objects.
ØThe system then selects the object with the highest likelihood, based on all the
evidence, as the correct object.
Hypothesizer
ØAll object recognition systems use models either explicitly or implicitly and
employ feature detectors based on these object models.
ØThe hypothesis formation and verification components vary in their importance
in different approaches to object recognition.
ØSome systems use only hypothesis formation and then select the object with
highest likelihood as the correct object.
ØPattern classification approaches are a good example of this approach.
ØMany artificial intelligence systems, on the other hand, rely little on the
hypothesis formation and do more work in the verification phases.
ØIn fact, one of the classical approaches, template matching, bypasses the
hypothesis formation stage entirely.
Cont..
ØAn object recognition system must select appropriate tools and techniques for
the steps discussed above.
ØMany factors must be considered in the selection of appropriate methods for a
particular application.
ØThe central issues that should be considered in designing an object recognition
system are:
Object or model representation
Feature extraction
Feature-model matching
Hypotheses formation
Object verification
Object or model representation
ØHow should objects be represented in the model database?
ØWhat are the important attributes or features of objects that must be captured
in these models?
ØFor some objects, geometric descriptions may be available and may also be
efficient, while for another class one may have to rely on generic or functional
features.
ØThe representation of an object should capture all relevant information without
any redundancies and should organize this information in a form that allows
easy access by different components of the object recognition system.
Feature extraction
ØWhich features should be detected, and how can they be detected reliably?
ØMost features can be computed in two dimensional images but they are related
to three-dimensional characteristics of objects.
ØDue to the nature of the image formation process, some features are easy to
compute reliably while others are very difficult.
Feature-model matching
ØHow can features in images be matched to models in the database?
ØIn most object recognition tasks, there are many features and numerous
objects.
ØAn exhaustive matching approach will solve the recognition problem but may
be too slow to be useful.
ØEffectiveness of features and efficiency of a matching technique must be
considered in developing a matching approach.
Hypotheses formation
ØHow can a set of likely objects based on the feature matching be selected, and
how can probabilities be assigned to each possible object?
ØThe hypothesis formation step is basically a heuristic to reduce the size of the
search space.
ØThis step uses knowledge of the application domain to assign some kind of
probability or confidence measure to different objects in the domain.
ØThis measure reflects the likelihood of the presence of objects based on the
detected features.
Object verification
ØHow can object models be used to select the most likely object from the set of
probable objects in a given image?
ØThe presence of each likely object can be verified by using their models.
ØOne must examine each plausible hypothesis to verify the presence of the
object or ignore it.
ØIf the models are geometric, it is easy to precisely verify objects using camera
location and other scene parameters.
ØIn other cases, it may not be possible to verify a hypothesis.
! !! r
e l l o pt e
s H c h a
a n k t h e
h
T d of
e e n
T h
! ! ! e
e l l o r s
H c o u
n k s h e a r t
h a f t y p n?
T nd o o r t i o
e t h e e s
he h e Q u
T or t u a
f y o
a v e
H

You might also like