26
KALASALINGAM UNIVERSITY Image Compression Under the guidance of B.Perumal Presented by H.Murugan(9915107001) ECE(DCN)

image basics and image compression

Embed Size (px)

Citation preview

Page 1: image basics and image compression

KALASALINGAM UNIVERSITY

Image Compression

Under the guidance of B.Perumal Presented by

H.Murugan(9915107001) ECE(DCN)

Page 2: image basics and image compression

Image:• An  image  is a  two  dimensional  signal.  It  is  defined  by  the mathematical function f(x,y)

•  where x and y are the two co ordinates      horizontally and vertically.Pixel:• The value of f(x,y) at any point is gives the     pixel value at that point of an image.Image Resolution:• It refers to number of pixels in an image

Page 3: image basics and image compression

Types of imageBinary image:   it contain only two pixel value o or 1Gray scale image:it has 256 different shades of colors in it, and ranges from 0 to 255

RGB Image/color image: for 8 bit format – it ranges from 0 to 255For 16 bit format – it ranges from 0 to 65535

Page 4: image basics and image compression

What is Compression Reduce the size of data. Compression is a way to reduce the number of bits  in a frame but retaining its meaning.

 Image compression can benefit users by having pictures load  faster  and web pages use up  less  space on a Web host. 

Image compression does not reduce the physical size of an image but instead compresses the data that makes up the image into a smaller size.

Page 5: image basics and image compression

Need for compression• To understand the need for compact image representation, consider the amount of data required to represent a 2 hour Standard Definition (SD) using 720 x 480 x 24 bit pixel arrays.

• A video is a sequence of video frames where each frame is a full color still image.

• Because video player must display the frames sequentially at rates near 30fps, SD video data must be accessed at

• 30fps x (720x480)ppf x 3bpp = 31,104,000 bps

Page 6: image basics and image compression

• Thus a 2 hour movie consists of • 31,104,000 bps x (602) sph x 2 hrs ≈ 2.24 x 1011 bytes.                                              OR                                         224GB of data• sph = second per hour• Twenty seven 8.5GB dual layer DVDs are needed to store it.

• To put a 2hr movie on a single DVD, each frame must be compressed by a factor of around 26.3.

• The compression must be even higher for HD, where image resolution reach 1920 x 1080 x 24 bits/image

Page 7: image basics and image compression

• Web page images & High-resolution digital camera photos also are also compressed to save storage space & reduce transmission time.

• Residential Internet connection delivers data at speeds ranging from 56kbps (conventional phone line) to more than 12mbps (broadband).

• Time required to transmit a small 128 x 128 x 24 bit full color image over this range of speed is from 7.0 to 0.03 sec.

• Compression can reduce the transmission time by a factor of around 2 to 10 or more.

• Similarly, number of uncompressed full color images that an 8 Megapixel digital camera can store on a 1GB Memory card can be increased.

Page 8: image basics and image compression

formats

Page 9: image basics and image compression

Compression Methods

Page 10: image basics and image compression

Lossless Compression:    When a file that has been compressed can be decoded back into its original form with zero loss of information, the compression is said to be a Lossless Compression

Lossy Compression:     If, after compression, the original file cannot be brought back again then the compression is said to be Lossy

Page 11: image basics and image compression

Method 1:Run-length encoding• Simplest method of compression.• How: replace consecutive repeating occurrences of a symbol 

by  1  occurrence  of  the  symbol  itself,  then  followed  by  the number of occurrences.

• The  method  can  be  more  efficient  if  the  data  uses  only  2 symbols  (0s  and  1s)  in  bit  patterns  and  1  symbol  is  more frequent than another.

Page 12: image basics and image compression

Method 2:Huffman CodingAssign fewer bits to symbols that occur more frequently and more bits to symbols appear less often.

There’s no unique Huffman code and every Huffman code has the same average code length.

Algorithm:① Make a leaf node for each code symbol

Add the generation probability of each symbol to the leaf node② Take the two leaf nodes with the smallest probability and connect them into 

a new nodeAdd 1 or 0 to each of the two branchesThe  probability  of  the  new  node  is  the  sum of  the  probabilities  of  the two connecting nodes

③ If there is only one node left, the code construction is completed. If not, go back to (2)

Page 13: image basics and image compression

Huffman Coding:

Original Source Source reductionSymbol Probability Code 1 2 3 4

a2 0.4 1 0.4 1 0.4 1 0.4 1 0.6 0 a6 0.3 00 0.3 00 0.3 00 0.3 00 0.4 1 a1 0.1 011 0.1 011 0.2 010 0.3 01 a4 0.1 0100 0.1 0100 0.1 011 a3 0.06 01010 0.1 0101 a5 0.04 01011

Page 14: image basics and image compression

How the encoding and decoding process takes place?

• Encoding:

• Decoding:

Page 15: image basics and image compression

Method 3:Lempel Ziv Encoding

• It is dictionary-based encoding

• Basic idea:  Create a dictionary(a table) of strings used during communication.

If both sender and receiver have a copy of the dictionary, then previously-encountered strings can be substituted by their index in the dictionary. 

Page 16: image basics and image compression

Contd...,This compression has 2 phases:

Building an indexed dictionary Compressing a string of symbols

• Algorithm for lempel ziv encoding: Extract the smallest substring that cannot be found in the remaining uncompressed string.

Store that substring in the dictionary as a new entry and assign it an index value

Substring is replaced with the index found in the dictionary

Insert the index and the last character of the substring into the compressed string

Page 17: image basics and image compression

Lossy Compression• Lossy  compression is  the  converse  of lossless  data 

compression.

• It is Used for compressing images and video files.

• Methods of lossy compression: JPEG: compress pictures and graphics MPEG:compress video MP3: compress audio 

Page 18: image basics and image compression

Method 1:JPEG Encoding• Used to compress pictures and graphics.• In JPEG, a grayscale picture is divided into 8x8 pixel blocks to decrease the number of calculations.

• Basic idea:  Change the picture into a linear (vector) sets of numbers that reveals the redundancies.

The redundancies is then removed by one of lossless.

Page 19: image basics and image compression

JPEG Encoding- DCT• DCT: Discrete Concise Transform• DCT transforms the 64 values in 8x8 pixel block in a way that 

the relative relationships between pixels are kept but the redundancies are revealed.

• Example:                      A gradient grayscale

Page 20: image basics and image compression

Quantization & CompressionQuantization:

After  T  table  is  created,  the  values  are  quantized  to  reduce  the number of bits needed for encoding.

Quantization  divides  the  number  of  bits  by  a  constant,  then  drops the  fraction.  This  is  done  to  optimize  the  number  of  bits  and  the number of 0s for each particular application.

• Compression: Quantized  values  are  read  from  the  table  and  redundant  0s  are 

removed. To  cluster  the 0s  together,  the  table  is  read diagonally  in  an  zigzag 

fashion.  The  reason  is  if  the  table  doesn’t  have  fine  changes,  the bottom right corner of the table is all 0s.

JPEG  usually  uses  lossless  run-length  encoding  at  the  compression phase.

Page 21: image basics and image compression

JPEG Encoding

Page 22: image basics and image compression

Method 2:MPEG Encoding• Used to compress video.

• Basic idea: Each video is a rapid sequence of a set of frames. Each frame is a spatial combination of pixels, or a picture.

Compressing video =          spatially compressing each frame                                    +          temporally compressing a set of frames.

Page 23: image basics and image compression

Types of MPEG compression• Spatial Compression

Each frame is spatially compressed by JPEG.

• Temporal Compression Redundant frames are removed. For example, in a static scene in which someone is talking, most frames are the same except for the segment around the speaker’s lips, which changes from one frame to the next.

Page 24: image basics and image compression

Advantages

• Used in remote sensing• In space exploration• Geological surveys for detecting mineral    resources In industries

Page 25: image basics and image compression

Applications

• Medical field• Internet• Astronomy• Defense• Machine/robot vision• Face recognition • Biometrics

Page 26: image basics and image compression

Thank you