Data compression

42
Data compression

description

Data compression. Data compression. lossless – looking for unicolor areas or repeating patterns Run length encoding Dictionary compressions Lossy – reduction of colors - approximating methods (JPEG). Grid graphics formats. BMP – no compression PCX – lossless compression RLE - PowerPoint PPT Presentation

Transcript of Data compression

Page 1: Data compression

Data compression

Page 2: Data compression

Data compression

• lossless – looking for unicolor areas or repeating patterns– Run length encoding– Dictionary compressions

• Lossy

– reduction of colors

- approximating methods (JPEG)

Page 3: Data compression

Grid graphics formats

• BMP – no compression• PCX – lossless compression RLE• PNG – lossless dictionary compression LZW • GIF – lossless dictionary compression LZW +

reduction to 256 color (adaptive palette)• JPG – approximating compression JPEG

Page 4: Data compression

JFIF format (JPEG File Interchange format)

sequential, common known

progressive, more effective, for computer net transmissions

lossless, not known and not widely supported

hierarchic, more resolutions in one file, quick preview

Page 5: Data compression

Sequential JFIF encoding

Page 6: Data compression

Color model transofmation

RGB → Y Cb CrY= 0,299*R + 0,587*G + 0,114*B (brightness)

Cb = - 0,1687*R - 0,3313*G + 0,5*B + 128

Cr = 0,5*R - 0,4187*G - 0,0813*B + 128

R = Y + 1.402*(Cr-128)

G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128)

B = Y + 1.772*(Cb-128)

Page 7: Data compression

Subsampling of Cb,Cr

Computing of average value for the block

• 2x1 pixels (6 bits sample), –6 bits -> 4 bits (compression 67%)

• or 2x2 pixels (12 bits sample), –12 bits -> 6 bits (compression 50%)

Page 8: Data compression

DCT transformation

Page 9: Data compression

Example

139 144 149 153 155 155 155 155144 151 153 156 159 156 156 156150 155 160 163 158 156 156 156159 161 162 160 160 159 159 159159 160 161 162 162 155 155 155161 161 161 161 160 157 157 157162 162 161 163 162 157 157 157162 162 161 161 163 158 158 158

Page 10: Data compression

DCT coefficientsAC coefficient (= 8 x average brightness

Page 11: Data compression

Quantization matrix – example for 90% “qality”

Page 12: Data compression

Quantization matrices• Defined by standardization committee JPEG. Separately for brightness and for color components.• Defined matrices for quality 10% and 90%.• For other values of quality between 10% and 90%obtained by linear interpolation.• For values under 10% or over 90% extrapolation can be used but it is not recommended.

Page 13: Data compression

Coefficients after quantisation

Page 14: Data compression

AC coefficients

• Stored separately• Not compressed• Possibility used for quick preview

Page 15: Data compression

Huffman encoding

Page 16: Data compression

Example

0, -2, -1, -1, -1, 0, 0, -1, -1, 0, 0, 0…..

Page 17: Data compression

Reconstruction of DCT coeffients

Page 18: Data compression

After inverse DCT transformation

Page 19: Data compression

Table of differences

Page 20: Data compression

Grid Pictures Modification

Page 21: Data compression

Geometrical Modifications

• Clip– Rectangular– Other shapes

• Rotate– Left, Right– 180 degrees– Flip

Page 22: Data compression

warping

Page 23: Data compression

warping

Page 24: Data compression
Page 25: Data compression

Morphing

Page 26: Data compression

Resolution modification

• Resolution / number of pixels /dimensions of picture

• Resolution Decreasing (average color of pixels)

• Resolution increasing

- copying of pixels

- dithering

Page 27: Data compression

Color depth decreasing

• Rounding of colors

• Establishing of color palette

• Half toning

• Dithering

Page 28: Data compression

Half Toning

• Half tone matrix– example

0 12 3 15

8 4 11 7

2 14 1 13

10 6 9 5

Page 29: Data compression

Floyd Steinberg dithering

7/16

3/165/16

1/16

Page 30: Data compression

Pixel color correction

• Color correction

• Saturation correction

• Brightness correction– Simple brightness correction– Contrast correction– Gamma correction

Page 31: Data compression

Saturation

S

Page 32: Data compression

Saturation correction

S

Page 33: Data compression

Brightness

Light

Page 34: Data compression

Brightness histogramm

K W

Page 35: Data compression

Color brightness

• Y = 0,299R + 0,587G + 0.114B

Page 36: Data compression

Simple brightness correction

Original br

New br

Page 37: Data compression

Simple brightness decreasing

Original br

New br

Page 38: Data compression

Contrast decreasing

Original br

New br

Page 39: Data compression

Contrast increasing

Original br

New br

Page 40: Data compression

Gamma correction of brightness

Original br

New br

Page 41: Data compression

Gamma function

Tedy

Y = 255 * (x/255)1/γ

Y = x1/γ

• Y = ymin + (ymax-ymin)*(x/xmax)1/γ

Page 42: Data compression

Gamma correction

Original brightness On <0,1> γ=0,5 γ=2,2

0 0 0 0 0 0

10 0,039216 0,001538 0,392157 0,229437 58,50645

20 0,078431 0,006151 1,568627 0,314409 80,17437

60 0,235294 0,055363 14,11765 0,518046 132,1018

128 0,501961 0,251965 64,25098 0,731039 186,4151

200 0,784314 0,615148 156,8627 0,895449 228,3395

255 1 1 255 1 255