0% found this document useful (0 votes)
4 views24 pages

Lecture 12

The document covers the fundamentals of image compression and watermarking, detailing concepts such as data redundancy, measuring image information, and fidelity criteria. It discusses various image compression models, coding methods, and the purpose of image watermarking for copyright and authenticity. The lecture emphasizes the importance of understanding both objective and subjective criteria in assessing compression performance.
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)
4 views24 pages

Lecture 12

The document covers the fundamentals of image compression and watermarking, detailing concepts such as data redundancy, measuring image information, and fidelity criteria. It discusses various image compression models, coding methods, and the purpose of image watermarking for copyright and authenticity. The lecture emphasizes the importance of understanding both objective and subjective criteria in assessing compression performance.
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/ 24

EENG 860 Special Topics: Digital Image Processing

Lecture 12: Introduction to Image


Compression and Watermarking

Dr. Ahmadreza Baghaie


Department of Electrical and Computer Engineering
New York Institute of Technology

Spring 2020

Readings: Chapter 8
1 / 24
How to read: relaxed, with notes!
Table of Content

● Image Compression Fundamentals


● Redundancies
● Measuring Image Information
● Fidelity Criteria
● Image Compression Models
● Image Coding
● Image Watermarking

2 / 24
Image Compression Fundamentals

● Data compression is the process of reducing the amount of data required


to represent a given quantity of information.
● Data and information are not the same: data are the means for conveying
information.
● Various amounts of data can be used to represent the same amount of
information.
● Redundancy happens when irrelevant or repeated data is used.
● Assume b and b’ are the number of bits used for representation of the same
information. The relative data redundancy R with b bits is:

1
R=1−
C
where C, known as the compression ratio is defined as:

b
C=
b' 3 / 24
Image Compression Fundamentals

● In image processing, b is the total number of bits used to represent an array


of intensity values.
● Three types of redundancies are common in images:
– Coding redundancy: redundancy caused by more than necessary bits
in the code words used to represent images
– Spatial and temporal redundancy: spatial and temporal correlations
between pixels of an image or a sequence of images causes
unnecessary replication of information.
– Irrelevant information: information that is irrelevant to the features of
our interest.

4 / 24
Coding Redundancy

● Assume a random variable rk in the interval [0,L-1] representing the intensity


levels of an MxN image.
● The normalized histogram is shown as:
nk
pr (r k )= k =0,1,2,. .. , L−1
MN
where pr(rk) is the probability of intensity value rk, nk is the number of times
that rk appears in the image.
● If the number of bits used for representing each value of rk is function l(rk),
the average number of bits required to represent each pixel in the image can
be calculated as:
L−1
Lavg =∑ l (r k ) pr (r k )
k =0

● Function l(rk) can be a constant, or variable.


5 / 24
Coding Redundancy – Example

● The intensity distribution of the image is shown in the table.

● In Code 1 (8-bit), the Lavg = 8 bits.


● In Code 2 (variable), the Lavg = 1.81 bits.
● The compression ratio, and subsequently, the relative data redundancy can
be calculated as:
M ×N ×8 1
C= ≈4.42 R=1− =0.774
M ×N ×1.81 4.42
● This means that 77.4% of the data in the original 8-bit 2D intensity array is
redundant.

6 / 24
Spatial And Temporal Redundancy

● The 256x256 image, and its intensity distribution are shown below.

● As can be seen, all 256 intensity levels have identical probabilities. So to


preserve all of the information, we need 8 bits to represent the intensities.
● However, since all the pixels in the same row in the image have identical
intensity value, we have spatial redundancy.
● Using a sequence of run-length pairs, specifying the start of a new intensity
and the number of consecutive pixels that have that intensity, we can
compress the information.
● Here this can be done by replacing each row with a single 8-bit intensity
value, and length 256 as the length of the row.
7 / 24
Irrelevant Information

● The 256x256 image, its intensity distribution and the histogram-equalized


version is shown below.

● The original image appears as a homogeneous filed of gray to the human


visual system, that can be represented by a single 8-bit value.
● The histogram-equalized version, shows some patterns that are not visible in
the original image.
● Whether the image can be represented by a single value, or as a whole
without any compression, depends on the specific application.

8 / 24
Measuring Image Information

● A random event E with probability P(E) contains I(E) units of information:


I ( E)=log [1/ P( E)]=−log P ( E)
● If P(E)=1, meaning the event always occurs, then I(E)=0, meaning no
information is attributed to it.
● Assuming a sequence of independent random events {a1,a2,…,aJ} with
probabilities {P(a1), P(a2), …, P(aJ)}, the entropy of the source is:
J
H=−∑ P (a j ) log P (a j )
j=1

● For an image with intensity levels rk, and probabilities pr(rk) we have:
L−1
~
H =− ∑ pr (r k ) log 2 pr (r k )
k =0

which is the lower bound on the compression that can be achieved when
coding statistically independent pixels directly.
9 / 24
Measuring Image Information – Example

● In the images below:

● The entropies are 1.664, 8 and 1.566 bits/pixel, respectively.


● Remember that the entropy is a lower bound on the compression that can be
achieved when coding statistically independent pixels directly.
● The amount of entropy, and thus information in an image, is not necessarily
intuitive.

10 / 24
Fidelity Criteria

● Compression may cause loss of information.


● Two types of criteria can be used for assessing the performance of
compression algorithms:
– Objective: a mathematical expression showing the error, for example
Root Mean Squared error (RMS) or Mean-Squared Signal-to-Noise
Ratio (SNR):
M −1 N −1 1/ 2

[
e RMS =
1
∑ ∑
MN x=0 y=0 ]
[ f^ ( x , y)−f ( x , y)]2

M −1 N−1
2
∑ ∑ [ f^ ( x , y )]
SNR ms = M −1 Nx−1
=0 y =0

∑ ∑ [ f^ ( x , y)−f ( x , y)]2
x=0 y=0

– Subjective: judged by humans.

11 / 24
Fidelity Criteria – Example

● For the following compressed images, the computed RMS errors are 5.17,
15.67 and 14.17, respectively.

● For subjective comparison, we can devise a table such as the following


example.

12 / 24
Image Compression Models

● An image compression system consists of two main components:


– Encoder: performs compression
– Decoder: performs decompression
● A codec is a device or program that is capable of both encoding and
decoding.
● A compression system can be lossless (information preserving) or lossy.

13 / 24
Image Compression Models

● The mapper transforms the input data into a usually non-visual format
designed to reduce spatial and temporal redundancy. This operation is
generally reversible.
● The quantizer reduces the accuracy of the mapper’s output in accordance
with a pre-established fidelity criterion, to keep irrelevant information out of
the compressed representation. This operation is lossy and generally non-
reversible. So if error-free compression is desired, should be removed.
● The symbol encoder generates a fixed-length or variable-length code to
represent the quantizer output. This operation is reversible.
● The symbol decoder and the inverse mapper perform the inverse
operations of the encoder’s symbol encoder and mapper, respectively.

14 / 24
Image Formats, Containers and Compression
Standards
● An image format is a standard way to organize and store image data.
● An image container is similar to a file format, but handles multiple types of
image data.
● Image compression standards define procedures for compressing and
decompressing images, reducing the amount of data needed for
representing an image.

15 / 24
Image Formats, Containers and Compression
Standards

16 / 24
Image Formats, Containers and Compression
Standards

17 / 24
Image Formats, Containers and Compression
Standards

18 / 24
Image Coding

● Common image coding methods:


– Huffman coding – Section 8.2
– Golomb coding – Section 8.3
– Arithmetic coding – Section 8.4
– LZW coding – Section 8.5
– Run-length coding – Section 8.6
– Symbol-based coding – Section 8.7
– Bit-plane coding – Section 8.8
– Block transform coding – Section 8.9
– Predictive coding – Section 8.10
– Wavelet coding – Section 8.11

19 / 24
Image Watermarking

● Image watermarking is the process of inserting data into an image for:


– Copyright identification
– User identification or fingerprinting
– Authenticity determination
– Automated monitoring
– Copy protection
● In general, watermarks can be:
– Visible: an opaque or semi-transparent sub-image or image placed on
top of another image.
– Invisible: cannot be seen by the naked eye, but can be recovered with
appropriate decoding algorithms.
● Invisible watermarks can be:
– Fragile: watermark is destroyed when the image is modified
– Robust: watermark survives image modification 20 / 24
Image Watermarking – Examples

● The following is an example of a visible watermark generated by:


f w =(1−α )f + α w
where fw is the watermarked image, f is the original image, w is the
watermark and α is the constant that controls the relative visibility of the
watermark and the underlying image.

21 / 24
Image Watermarking – Examples

● The following is an example of an invisible fragile watermark generated as


follows:
f w
f w =4 ( )+
4 64
where unsigned integer arithmetic is used.
● Dividing and multiplying by 4 sets the two least significant bits of f to 0.
Dividing w by 64 shifts its two most significant bits into the two least
significant bit positions. Adding the two generates the LSB watermarked
image.

22 / 24
What is Next?

● Learn on your own …


● Write your own codes ...
● Experiment with image processing libraries …

23 / 24
Questions?
[email protected]

24 / 24

You might also like