1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar...

Post on 19-Dec-2015

214 views 1 download

transcript

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

2

Presentation OverviewPresentation Overview

Project goalsTheoretical BackgroundPossible SolutionsThe algorithmResults & Conclusions

3

Project GoalsProject Goals

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

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

4

Theoretical BackgroundTheoretical Background

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

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

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

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.

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.

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

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

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.

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.

13

The AlgorithmThe Algorithm

Input – gray scale image

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

15

The Algorithm Cont.The Algorithm Cont.

16

The Algorithm Cont.The Algorithm Cont.

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

18

The Algorithm Cont.The Algorithm Cont.

Decompressing Adding the JPEG

picture to the GIF picture

Visual comparison, MSE & PSNR calculations.

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)) 

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

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

22

Coins ExampleCoins Example

23

Example – Cont.Example – Cont.

24

Example – Cont.Example – Cont.