0% found this document useful (0 votes)
23 views

Module - 5 Image Data Compression

Image data

Uploaded by

Om Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Module - 5 Image Data Compression

Image data

Uploaded by

Om Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Image Data

Compression
MODULE 5
Image Compression
➢The compression of images is carried out by an encoder and output a compressed form of an
image

➢Image compression is the process of encoding or converting an image file in such a way that it
consumes less space than the original file

➢It reduces the size of an image file without affecting or degrading its quality to a greater extent

➢Image compression is typically performed through an image/data compression algorithm or


codec
Image Compression
Why Do We Need Image Compression?
➢ Consider a black and white image that has a resolution of 1000*1000 and each pixel uses 8 bits to
represent the intensity

➢ So, the total no of bits req= 1000*1000*8 = 80,00,000 bits per image

➢ We need a way to have proper representation as well to store the information about the image in a
minimum no of bits without losing the character of the image

➢ Thus, image compression plays an important role


Image Compression
Image Compression Model
Symbol Encoding
➢The symbol stage involves where the distinct characters involved in the image are encoded in a
way that the no. of bits required to represent a character is optimal based on the frequency of
the character’s occurrence

➢In this stage codewords are generated for the different characters present

➢By doing so we aim to reduce the no. of bits required to represent the intensity levels and
represent them in an optimum number of bits.

➢There are many encoding algorithms

➢The popular one is: Huffman coding


Huffman Coding
Huffman Coding
➢In the Huffman coding scheme, we try to find the codes in such a way that none of the
codes are the prefixes to the other

➢And based on the probability of the occurrence of the character the length of the code is
determined

➢In order to have an optimum solution the most probable character has the smallest
length code
Huffman Coding
Huffman Coding
Example:
Huffman Coding
Example:
Huffman Coding
Example:
Huffman Coding
Example:
Huffman Coding
Example:
Huffman Coding
Example:
Huffman Coding
Example:
Huffman Coding

Symbol S0 S1 S2 S3 S4
Probability 0.4 0.2 0.2 0.1 0.1
Huffman Coding
Arithmetic Coding
Arithmetic Coding
Example:
Arithmetic Coding
Example: Consider the probabilities p(a)=0.2, p(b)=0.3, p( c) =0.1,

p(d)=0.4.

Encode the sequence ‘abcad’ using Arithmetic Coding Technique.


Dictionary based Coding
Dictionary based Coding
Dictionary based Coding
Dictionary based Coding
Image compression
standards- JPEG &MPEG
JPEG Compression
➢"Joint Photographic Expert Group" -- an international standard in 1992

➢JPEG is designed for full-color or grayscale images

➢It works very well with photographic images

➢JPEG is a lossy image compression method

➢JPEG compression uses the DCT (Discrete Cosine Transform) method for coding transformation

➢The JPEG standard works by averaging color variation and discard the information that the human eye

cannot see
How JPEG compression works
➢The raw image is first converted to a different color model, which separates the color of a pixel from its brightness

➢Image is divided into a small block which is having 8×8 block

➢Then RGB is converted into Y-Cb-Cr

➢After that, DCT is applied to each block of pixels and converts the image from the spatial domain to the frequency
domain

➢Then make the resulting image quantized, because human eyes can not see high frequency

➢After quantization, zigzag scan is performed on these quantized 8×8 blocks to group the low-frequency coefficients

➢The coefficients is then encoded by Huffman coding to get the final image
Process Of JPEG Compression
How JPEG compression works
•Splitting –
We split our image into the blocks of 8*8 blocks. It forms 64 blocks in which each block is referred to
as 1 pixel.

•Color Space Transform –


In this phase, we convert R, G, B to Y, Cb, Cr model. Here Y is for brightness, Cb is color blueness and
Cr stands for Color redness. We transform it into chromium colors as these are less sensitive to
human eyes thus can be removed.

•Apply DCT –
We apply Direct cosine transform on each block. The discrete cosine transform (DCT) represents an
image as a sum of sinusoids of varying magnitudes and frequencies.
How JPEG compression works
•Quantization –
In the Quantization process, we quantize our data using the quantization table.

•Serialization –
In serialization, we perform the zig-zag scanning pattern to exploit redundancy.

•Vectoring –
We apply DPCM (differential pulse code modeling) on DC elements. DC elements are used to define the strength
of colors.

•Encoding –
In the last stage, we apply to encode either run-length encoding or Huffman encoding. The main aim is to convert
the image into text and by applying any encoding we convert it into binary form (0, 1) to compress the data.
Advantages of JPEG
➢It has very good compression rate, image quality

➢JPEG standard is supports 24-bit color with up to 16 million colors

➢JPEG files are very small in size

➢Image Processing time is much faster than other image standards

➢It is suitable for full-color realistic images with a lot of color

➢JPEG is compatible with every computer, mobile devices, camera devices and also photo editors

➢There is no need of editing required to print any image


MPEG
➢Short for Moving Picture Experts Group, and pronounced m-peg, is a working group of the ISO

➢MPEG was first proposed in 1991

➢It is actually a family of standards for compressed digital movies

➢The MPEG standards consist of three main parts: video, audio, and systems

➢MPEG algorithms compress data to form small bits that can be easily transmitted and then
decompressed

➢The video information is encoded using a technique called Discrete Cosine Transform (DCT)
MPEG
Function of MPEG :

➢Storing audios in Compact disc(CD).

➢Storing of videos on digital video tapes.

Working of MPEG :

➢MPEG follows an algorithm in which the data are compressed into small bits

➢The compression rate of MPEG is high because it doesn’t store the complete frame, it only stores the
changes that has been done to the frames

➢Hence it reduce the size of overall file


MPEG
The compression is achieved using five different compression techniques:

➢The use of a frequency-based transform

➢Quantization, a technique for losing selective information

➢Huffman coding, a technique of lossless compression

➢Motion compensated predictive coding

➢Bi-directional prediction
MPEG
There currently are several MPEG standards.

➢MPEG-1 is intended for intermediate data rates, on the order of 1.5 Mbit/sec.

➢MPEG-2 is intended for high data rates of at least 10 Mbit/sec.

➢MPEG-3 was intended for HDTV compression but was found to be redundant and was merged
with MPEG-2.

➢MPEG-4 is intended for very low data rates of less than 64 Kbit/sec.
Morphological
Operation
Morphological Operation
➢It processes digital images based on their shapes

➢Each image pixel is corresponding to the value of other pixel in its neighborhood

➢By choosing the shape and size of the neighborhood pixel, you can construct a morphological

operation that is sensitive to specific shapes in the input image

➢Morphological operations apply a structuring element called strel, to an input image, creating

an output image of the same size


Morphological Operations
➢Morphology is a broad set of image processing operations that process images based
on shapes.

➢Morphological operations apply a structuring element to an input image, creating an


output image of the same size.

➢In a morphological operation, the value of each pixel in the output image is based on a
comparison of the corresponding pixel in the input image with its neighbors.
Types of Morphological operations
•Dilation: Dilation adds pixels on the object boundaries.

•Erosion: Erosion removes pixels on object boundaries.

•Open: The opening operation erodes an image and then dilates the eroded image, using the same

structuring element for both operations.

•Close: The closing operation dilates an image and then erodes the dilated image, using the same

structuring element for both operations.


Terminologies in Morphological Image Processing
➢All morphological processing operations are based on mentioned terms:

➢Structuring Element: It is a matrix or a small-sized template that is used to traverse an image.


The structuring element is positioned at all possible locations in the image, and it is compared
with the connected pixels. It can be of any shape.
Fit: When all the pixels in the structuring element cover the pixels of the object, we call it Fit.
Hit: When at least one of the pixels in the structuring element cover the pixels of the object, we
call it Hit.
Miss: When no pixel in the structuring element cover the pixels of the object, we call it miss.
Structuring Element
Terminologies in Morphological Image Processing
➢Figure shows the visualization of terminologies used in morphological image processing:
Morphological Dilation and Erosion
➢The most basic morphological operations are dilation and erosion

➢Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels
on object boundaries

➢The number of pixels added or removed from the objects in an image depends on the size
and shape of the structuring element used to process the image

➢In the morphological dilation and erosion operations, the state of any given pixel in the
output image is determined by applying a rule to the corresponding pixel and its neighbors in
the input image

➢The rule used to process the pixels defines the operation as a dilation or an erosion.
Morphological Dilation
Morphological Dilation
➢The value of the output pixel is the maximum value of all pixels in the neighborhood.

➢In a binary image, a pixel is set to 1 if any of the neighboring pixels have the value 1.
➢Morphological dilation makes objects more visible and fills in small holes in objects.
➢Lines appear thicker, and filled shapes appear larger.
The following figure illustrates the dilation of a binary image.
The structuring element defines the neighborhood of the pixel
of interest, which is circled. The dilation function applies the
appropriate rule to the pixels in the neighborhood and assigns
a value to the corresponding pixel in the output image. In the
figure, the morphological dilation function sets the value of
the output pixel to 1 because one of the elements in the
Morphological neighborhood defined by the structuring element is on.

Dilation
Morphological Erosion
Morphological Erosion
➢The value of the output pixel is the minimum value of all pixels in the neighborhood. In a

binary image, a pixel is set to 0 if any of the neighboring pixels have the value 0.
➢Morphological erosion removes floating pixels and thin lines so that only substantive
objects remain.
➢Remaining lines appear thinner and shapes appear smaller.
Morphological Opening
➢The opening operation erodes an image and then dilates the eroded image, using the

same structuring element for both operations.

➢Morphological opening is useful for removing small objects and thin lines from an

image while preserving the shape and size of larger objects in the image.
Morphological Opening
Morphological Closing
➢The closing operation dilates an image and then erodes the dilated image, using the

same structuring element for both operations.

➢Morphological closing is useful for filling small holes in an image while preserving the

shape and size of large holes and objects in the image.


Morphological Closing

You might also like