Professional Documents
Culture Documents
DIP - Unit-IV
DIP - Unit-IV
Unit- IV
Wavelets
Unlike the Fourier transform, whose basis functions are sinusoids, wavelet
transforms are based on small waves, called wavelets, of varying frequency
and limited duration.
1
07-11-2020
Wavelets
Dr. R. Rajkamal
Subband Coding
In subband coding, an image is decomposed into a set of bandlimited components,
called subbands.
Dr. R. Rajkamal
2
07-11-2020
Subband Coding
The analysis filter bank, which includes filters h0(n) and h1(n), is used to break input
sequence f(n) into two half length sequences flp(n) and fhp(n) the subbands that represent
the input.
Dr. R. Rajkamal
Dr. R. Rajkamal
3
07-11-2020
Wavelet Definition
“The wavelet transform is a tool that cuts up data, functions or operators into different
frequency components, and then studies each component with a resolution matched to
its scale”
Dr. R. Rajkamal
scaling
• It lets you either narrow down the frequency band of interest, or
determine the frequency content in a narrower time interval
• Scaling = frequency band
• Good for non-stationary data
• Low scalea Compressed wavelet Rapidly changing
detailsHigh frequency .
• High scale a Stretched wavelet Slowly changing, coarse
features Low frequency
Dr. R. Rajkamal
4
07-11-2020
3. Shift the wavelet to the right and repeat steps 1 and 2 until you've covered the whole
signal.
Small scale
-Rapidly changing details,
4. Scale (stretch) the wavelet and repeat steps 1 through 3. -Like high frequency
Large scale
5. Repeat steps 1 through 4 for all scales. -Slowly changing
details
-Like low frequency
Dr. R. Rajkamal
Dr. R. Rajkamal
5
07-11-2020
Haar Transform
Haar transform, separable and symmetric
Dr. R. Rajkamal
6
07-11-2020
Dr. R. Rajkamal
Dr. R. Rajkamal
7
07-11-2020
Dr. R. Rajkamal
Applications of wavelets
• Pattern recognition
– Biotech: to distinguish the normal from the pathological membranes
– Biometrics: facial/corneal/fingerprint recognition
• Feature extraction
– Metallurgy: characterization of rough surfaces
• Trend detection:
– Finance: exploring variation of stock prices
• Perfect reconstruction
– Communications: wireless channel signals
• Video compression – JPEG 2000
Dr. R. Rajkamal
8
07-11-2020
Fundamentals of Compression
• To better understand the need for compact image representations, consider
the amount of data required to represent a two-hour standard definition
(SD) television movie using 720 x 480 x 24 bit pixel arrays.
• A digital movie (or video) is a sequence of video frames in which each frame
is a full-color still image.
• Because video players must display the frames sequentially at rates near 30
fps (frames per second), SD digital video data must be accessed at
Dr. R. Rajkamal
Fundamentals of Compression
• 224 GB (gigabytes) of data.
• Twenty-seven 8.5 GB dual-layer DVDs (assuming conventional 12 cm disks) are needed to
store it.
• To put a two-hour movie on a single DVD, each frame must be compressed—on average—
by a factor of 26.3.
• The compression must be even higher for high definition (HD) television, where image
resolutions reach 1920 * 1080 * 24 bits/image.
The term data compression refers to the process of reducing the amount of
data required to represent a given quantity of information.
Data and information are not the same thing;
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.
Dr. R. Rajkamal
9
07-11-2020
Fundamentals of Compression
Types of data redundancies
1. Coding redundancy.
• 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.
2. Spatial and temporal redundancy.
• Because the pixels of most 2-D intensity arrays are correlated spatially (i.e., each pixel is similar
to or dependent on 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 on pixels in
nearby frames) also duplicate information.
3. Irrelevant information.
• 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.
Dr. R. Rajkamal
Fundamentals of Compression
Example:
Compression Ratio: original image = 256 x 256 pixels,
Single band (gray-scale) 8 bits/pixel = file is 65536 bytes (64K)
Compression Ratio = Uncompressed file size after compression image file = 6554 bytes
Compressed file size Compression Ratio= 10 => 10:1 => 10 to 1 compression
=> 10 times compression
i.e. image has been compressed to 1/10 original size
Fidelity Criteria (1) objective fidelity criteria and (2) subjective fidelity criteria.
Dr. R. Rajkamal
10
07-11-2020
Image Compression
The encoder performs
compression, and the decoder
performs the complementary
operation of decompression.
Both operations can be
performed in software, as is the
case in Web browsers and many
commercial image editing
programs, or in a combination of
hardware and firmware, as in
commercial DVD players.
A codec is a device or program
that is capable of both encoding
and decoding.
Dr. R. Rajkamal
Image Compression
Compression Decompression
Data Reduction
- reduce image data by gray-level and/or spatial quantization,
or can undergo any desired image enhancement (e.g. noise Decoding
removal ) process.
- takes the compressed file and reverses the
Mapping original coding by mapping the
- maps the original data into another mathematical space codes to the original, quantized values.
where it is easier to compress the data. Inverse Mapping
Quantization - reverse the original mapping process.
- It takes the potentially continuous data from the mapping Postprocessing
stage and puts it in discrete form.
- This operation is irreversible, so must be omitted if error- - enhance the look of the final image.
free compression is desired.
Coding
- maps the discrete data from the quantizer onto a code in an
optimal manner. Dr. R. Rajkamal
11
07-11-2020
Dr. R. Rajkamal
Image Compression
Data ( Text, Graphics, Still Images and Video Animation, Sounds)compression is the process of
encoding data so that it takes less storage space or less transmission time than it would if it were
not compressed.
The fundamental task of image compression is to reduce the amount of data required to
represent the image. This is done by transforming and removing image data redundancies.
There are two major categories of compression algorithms:
• Lossless compression algorithms
• Lossy compression algorithms
Why Compression ?
To reduce the volume of data to be transmitted (text, fax, images)
To reduce the bandwidth required for transmission and to reduce storage requirements (speech, audio, video)
Dr. R. Rajkamal
12
07-11-2020
Image Compression
Lossy compression algorithms
The original data is reconstructed perfectly
Theoretical limit on maximal compression
Practical compression ratios of <10 : 1 (still images)
Lossless compression
lossless compression for legal and medical documents, computer programs
exploit only code and inter-pixel redundancy
Dr. R. Rajkamal
Huffman coding
One of the most popular techniques for removing coding redundancy is due to Huffman
(Huffman [1952]).
When coding the symbols of an information source individually, Huffman coding yields the
smallest possible number of code symbols per source symbol.
In practice, the source symbols may be either the intensities of an image or the output of an
intensity mapping operation (pixel differences, run lengths, and so on).
Dr. R. Rajkamal
13
07-11-2020
At the far left, a hypothetical set of source symbols and their probabilities are ordered from top to bottom
in terms of decreasing probability values.
To form the first source reduction, the bottom two probabilities, 0.06 and 0.04, are combined to form a
“compound symbol” with probability 0.1.
This compound symbol and its associated probability are placed in the first source reduction column so that
the probabilities of the reduced source also are ordered from the most to the least probable.
This process is then repeated until a reduced source with two symbols (at the far right) is reached.
Dr. R. Rajkamal
Huffman coding
Dr. R. Rajkamal
14
07-11-2020
Huffman coding
Second step
The in Huffman’s procedure is to code each reduced
source, starting with the smallest source and working
back to the original source.
The minimal length binary code for a two-symbol source,
of course, are the symbols 0 and 1.
Symbols are assigned to the two symbols on the right (the assignment is arbitrary; reversing the order of
the 0 and 1 would work just as well).
As the reduced source symbol with probability 0.6 was generated by combining two symbols in the reduced
source to its left, the 0 used to code it is now assigned to both of these symbols, and a 0 and 1 are arbitrarily
appended to each to distinguish them from each other.
This operation is then repeated for each reduced source until the original source is reached.
The final code appears at the far left.
Dr. R. Rajkamal
Huffman coding
The average length of this code is
Huffman’s procedure creates the optimal code for a set of symbols and probabilities subject to the constraint
that the symbols be coded one at a time.
After the code has been created, coding and/or error-free decoding is accomplished in a simple lookup table
manner. The code itself is an instantaneous uniquely decodable block code.
It is called a block code because each source symbol is mapped into a fixed sequence of code symbols.
It is instantaneous because each code word in a string of code symbols can be decoded without referencing
succeeding symbols. It is uniquely decodable because any string of code symbols can be decoded in only one
way.
Dr. R. Rajkamal
15
07-11-2020
Huffman coding
Dr. R. Rajkamal
Huffman coding
Dr. R. Rajkamal
16
07-11-2020
Vertical Scanning
Dr. R. Rajkamal
Dr. R. Rajkamal
17
07-11-2020
Arithmetic coding
Arithmetic coding generates nonblock codes.
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.
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
More information creates a lower measure of entropy. Less information creates a higher measure of entropy.
Dr. R. Rajkamal
Arithmetic coding
18
07-11-2020
LZW algorithm
The LZW algorithm is a very common compression technique.
This algorithm is typically used in GIF and optionally in PDF and TIFF.
It is lossless, meaning no data is lost when compressing.
The algorithm is simple to implement and has the potential for very high
throughput in hardware implementations.
It is the algorithm of the widely used Unix file compression utility compress,
and is used in the GIF image format.
Dr. R. Rajkamal
LZW algorithm
Dr. R. Rajkamal
19
07-11-2020
LZW algorithm
Dr. R. Rajkamal
LZW algorithm
Characteristic features of LZW includes,
LZW compression uses a code table, with 4096 as a common choice for the number of table entries.
Codes 0-255 in the code table are always assigned to represent single bytes from the input file.
When encoding begins the code table contains only the first 256 entries, with the remainder of the
table being blanks. Compression is achieved by using codes 256 through 4095 to represent sequences
of bytes.
As the encoding continues, LZW identifies repeated sequences in the data, and adds them to the
code table.
Decoding is achieved by taking each code from the compressed file and translating it through the code
table to find what character or characters it represents.
Dr. R. Rajkamal
20
07-11-2020
Transform Coding
Dr. R. Rajkamal
Transform selection
Block transform coding systems based on a variety of discrete 2-D transforms have been
constructed and/or studied extensively.
The choice of a particular transform in a given application depends on the amount of
reconstruction error that can be tolerated and the computational resources available.
Compression is achieved during the quantization of the transformed coefficients.
r(x, y, u, v) s(x, y, u, v) are called the forward and inverse transformation kernels
Dr. R. Rajkamal
21
07-11-2020
JPEG compression
JPEG stands for Joint photographic experts group. It is the first international standard in
image compression.
It could be lossy as well as lossless .
But the technique taken for discussion is lossy compression technique.
First step is to divide an image into blocks with each having dimensions of 8 x8.
Dr. R. Rajkamal
JPEG compression
The range of the pixels intensities now are from 0 to 255. We will change the range from -
128 to 127.
Subtracting 128 from each pixel value yields pixel value from -128 to 127. After subtracting
128 from each of the pixel value, we got the following results.
Dr. R. Rajkamal
22
07-11-2020
JPEG compression
There is a standard matrix that is used for computing JPEG compression, which is given by
a matrix called as Luminance matrix.
This matrix is
Dr. R. Rajkamal
23