1 preprocessing for jpeg compression elad davidson & lilach schwartz project supervisor: ari...

24
1 Preprocessing for Preprocessing for JPEG Compression JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY Department of Electrical Engineering The Vision Research and Image Science Laboratory

Post on 19-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

1

Preprocessing for JPEG Preprocessing for JPEG CompressionCompression

Elad Davidson & Lilach Schwartz

Project Supervisor: Ari Shenhar

SPRING 2000

TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

Department of Electrical Engineering

The Vision Research and Image Science Laboratory

Page 2: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

2

Presentation OverviewPresentation Overview

Project goalsTheoretical BackgroundPossible SolutionsThe algorithmResults & Conclusions

Page 3: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

3

Project GoalsProject Goals

Compression– JPEG, GIF– Quality vs. File’s size

Object Segmentation– Secondary goal: Separate the objects in the picture.

Page 4: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

4

Theoretical BackgroundTheoretical Background

JPEG CompressionGIF CompressionMathematical Morphology– Dilation, Erosion, Opening, Closing

Page 5: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

5

JPEGJPEG

Lossy Useful for nature pictures, photos, and smooth

pictures. Compression ratio:

1:5 for gray scale image,

1:10 – 1:20 for color image

Page 6: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

6

JPEGJPEG Cont.Cont. : :

Method: separate the picture to small blocks (8x8) DCT conversion LPF Uniform quantizer (Max – Loyd) Hophman coding (lossless) Creating an header with the information needed

for the image decompressing

Page 7: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

7

GIFGIF

Compression algorithm for colored or gray scale pictures

Lossless, compressing ratio – 1:4 to 1:10 Method: scanning the picture, searching for a

sequence of similar pixels, insert the sequence into a translate table (LUT) and use this table any time such a sequence is encountered

Useful for pictures with only a few gray levels or images with objects that have sharp edges.

Page 8: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

8

Mathematical MorphologyMathematical Morphology

Erosion– Purpose: remove pixel with weak link– Method: subtracting the structure element from each

pixel’s area and replacing the pixel’s value with the minimum value of this area.

Page 9: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

9

Mathematical MorphologyMathematical Morphology Cont.Cont.

Dilation– Purpose: extending an object– Method: like erosion but the structure is added and the

pixel is replaced with the maximum value in the area

Page 10: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

10

Mathematical MorphologyMathematical Morphology Cont.Cont.

Opening – Purpose: remove small objects, sharpen edges and eliminate

noise.

– Method: erosion and dilation.

* before vs. after

Closing– Purpose: combine objects that have been separated

– Method: dilation and erosion

Page 11: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

11

Possible SolutionsPossible Solutions

Problem: Object Identification- Edge detection - identify the edge and separate it’s inner

part.

1. Morphological operation -subtracting the picture after dilation from the original picture

2. CANNY Algorithm – an edge detection algorithm

** Problems – the direction of the edge and what is the inner part of the object are hard to define.

- Histogram - using local maxima and separating all it’s neighboring pixels.

** Problems - one maximum can be hidden in another maximum and the

object won’t be separated.

Page 12: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

12

Possible Solutions – Cont.Possible Solutions – Cont.

Problem: Representative gray-scale level– Max-Loyd quantizer – iterative algorithm that

calculates the center of mass.

** Problems – not efficient for one level quantizing because it can convergent to a local minima

– Scalar quantizer – cut LSBits from the pixels.

** Problems – no relation to the actual data of the picture.

Page 13: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

13

The AlgorithmThe Algorithm

Input – gray scale image

Page 14: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

14

The Algorithm Cont.The Algorithm Cont.

Objects’ segmentation– Opening - smooth

the edges and reduce noise.

– Raster scan - object segmentation. Each object gets its representative value.

– The result is the ‘cluster’ matrix

Page 15: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

15

The Algorithm Cont.The Algorithm Cont.

Page 16: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

16

The Algorithm Cont.The Algorithm Cont.

Page 17: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

17

The Algorithm Cont.The Algorithm Cont.

Find the representative gray scale level Objects’ uniting Image subtracting - the united picture is

subtracted from original image JPEG compression to the image after the

subtraction GIF compression to the ‘united’ picture

Files’ size calculations - GIF & JPEG

Page 18: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

18

The Algorithm Cont.The Algorithm Cont.

Decompressing Adding the JPEG

picture to the GIF picture

Visual comparison, MSE & PSNR calculations.

Page 19: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

19

Results & ConclusionsResults & Conclusions

Visual Comparison MSE – Mean Square Error PSNR – Peak Signal to Noise Ratio (dB) File’s Size

MSE =                                 

PSNR =   20 * log10 (255 / sqrt(MSE)) 

Page 20: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

20

ResultsResults

Orig. JPEG

JPEG +GIF

GIF size

JPEG size

PSNR MSE name

4.89 1.88 1.25 0.63 33.48 29.13 Gray_pk

5.12 3.37 1.62 1.75 25.77 172.04 Eight

4.29 3.48 1.53 1.95 31.27 48.43 Coins

7.83 1.859 1.36 0.499 72.44 0.0037 Test

Page 21: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

21

ConclusionsConclusions

Visual Comparison –– Good results for pictures with a large

difference between the objects and the background and pictures with sharp edges

–MSE/PSNR: the values were in the higher quality part of the value range

– File size: definitely smaller, about 2/3 of the size of the original picture

Page 22: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

22

Coins ExampleCoins Example

Page 23: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

23

Example – Cont.Example – Cont.

Page 24: 1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY

24

Example – Cont.Example – Cont.