• No results found

Compression Principles

N/A
N/A
Protected

Academic year: 2021

Share "Compression Principles"

Copied!
50
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

I. Don’t allocate space for values that never occur

• The image has values from 0 to 255

• But only 16 levels are occupied

(3)

I. Probabilistic extension

Example

Suppose we use

1 to code the value 128

0xxxx to code other values.

If 128 occurs with probability P, these pixels we save 3*P bits;

One extra bit at 1*(1-P) of the pixels.

For this strategy and 4 bits per pixel, the break even point is 3*P - 1*(1-P) = 0 4P – 1 = 0 P = 0.25 128 occurs with high probability Use short symbols to code values that occur a lot.

(4)

II. Spatial redundancy

Some percentage of the pixels are set to random intensity levels.

Subject must set the dot intensity to the correct value.

With 1% of the pixels deleted,

observers set the value to its original 80% of the time;

With 40% deleted, they are still correct half the time

Horace Barlow

(5)

The intensity histogram

Values are distributed

fairly uniformly across the different levels.

No obvious way to code the intensities efficiently.

(6)

The spatial correlation means we can recode to reduce the range Digital value (x) D igi ta l va lue ( x+ 1)

(7)

If we code the difference we reduce the variance

DV (x) Int ens it y di ff er enc e D V ( x+ 1) – D V (x) DV (x+1) – DV(x)

Difference is easier to compress:

(8)
(9)
(10)

u = x + y

v = x - y

9 bits9 bits

÷÷

ø

ö

çç

è

æ

÷÷

ø

ö

çç

è

æ

-=

÷÷

ø

ö

çç

è

æ

y

x

v

u

1

1

1

1

De-correlating image data

Do you know why u,v are 9 bits and

x,y are 8 bits?

The counter-intuitive observation is that

the potential range of the transformed data may be larger than the original range;

(11)
(12)

JPEG-DCT

Best lossless compression factors are around 3-5. People want more.

What to do?

(13)

Application: JPEG-DCT

• Compress the stuff people can’t see anyway. They will never know. • This is called lossy compression

(also called perceptually lossless compression).

(14)

Discriminating contrast levels

Low contrast High contrast Low f High f Harder to see contrast differences in high than low

(15)
(16)
(17)
(18)

Quantization table

(19)

Quantization table

(20)

Quantization table

(21)
(22)

The DCT formula 7 7 0 0 ( ) ( ) 2 1 2 1 ( , ) ( , )cos cos 4 x y 16 16 C u C v x y F u v f x y u

p

v

p

= = + + æ ö æ ö = ç ÷ ç ÷ è ø è ø

åå

Original to Transform

(23)

The DCT formula 7 7 0 0 ( ) ( ) 2 1 2 1 ( , ) ( , )cos cos 4 x y 16 16 C u C v x y F u v f x y u

p

v

p

= = + + æ ö æ ö = ç ÷ ç ÷ è ø è ø

åå

Original to Transform

(24)

DCT Basis Functions

Multiple resolution and orientation much like human vision models

(25)
(26)

8 6 6 7 6 5 8 7 7 7 9 9 8 10 12 20 13 12 11 11 12 25 18 19 15 20 29 26 31 30 29 26 28 28 32 36 46 39 32 34 44 35 28 28 40 55 41 44 48 49 52 52 52 31 39 57 61 56 50 60 46 51 52 50

Luminance table (default, q = 75)

Quantization matrix

Low spatial frequencies High spatial frequencies Quantization table

Number of output levels is ceil(256/value)

Quantization values

(27)

Low frequencies High frequencies 128 30 10 7 6 5 8 7 7 80 9 9 8 10 12 20 13 12 11 11 12 25 18 19 15 17 29 26 2 30 5 0 28 28 9 0 0 0 0 0 44 35 5 0 0 0 0 0 48 49 2 0 0 0 0 0 3 0 0 0 0 0 0 0

After scaling and quantization, there are many zeros in the coefficient table

Compressing the JPEG coefficients

(28)

Special handling of the DC term

1. DC Term is usually large

2. It is usually similar to the value in the previous block 3. So, the DC term is encoded as the difference from the

previous block

(29)

Repeated characters:

Data: AAAABBBAABBBBBCCCCCCC Code: 4A3B2A5B7C

Run length encoding

JPEG: is mostly zeros only in high spatial frequency, so method is not effective

Data: GBCDEAFGAAAAAA Code 1: 1G1B1C1D1E1A1F1G6A

Simple encoder/decoder

If B > 0 repeat next character B times If B < 0 copy next B characters to output If B = 0, stop

(30)

100 75

50 20

(31)

Artifact visibility depends on image size physical units

(32)
(33)
(34)

Aside – For EE parties:

Phase and amplitude scrambling

Randomize Amplitude Randomize Phase

(35)

JPEG – Color

Facts you know about color perception that matter for JPEG

(36)

JPEG color - informal

Color profile

Many JPEG files embed an ICC color profile (color space). Commonly used color profiles include sRGB and Adobe RGB. Because these color spaces use a non-linear transformation, the dynamic range of an 8-bit JPEG file is

about 11 stops; see gamma curve. [However, many applications are

not able to deal with JPEG color profiles and simply ignore them.

(emphasis added, text deleted at some point).]

(37)

JPEG color space: YCbCr

0.299

0.587

0.114

0

0.1687

0.3313

0.5

128

0.5

0.4187

0.0813

128

Y

R

Cb

G

Cr

B

æ

ö æ

öæ ö æ

ö

ç

÷ ç

= -

-

÷ç ÷ ç

+

÷

ç

÷ ç

÷ç ÷ ç

÷

ç

÷ ç

-

-

÷ç ÷ ç

÷

è

ø è

øè ø è

ø

(38)

Default luminance table (q=75)

Y = 0.299R + 0.587G + 0.114B

Cb = -0.1687R - 0.3313G + 0.5B + 128 Cr = 0.5R - 0.4187G - 0.0813B + 128

JPEG Color: YCbCr

(39)

Target is an RGB image

Y = 0.299 R + 0.587 G + 0.114 B I = 0.596 R - 0.275 G - .321 B Q = 0.212 R - 0.523 G + .311 B

For transmission in the US, the image was converted to YIQ Transformed to

(40)

I Q

Y Q

(41)
(42)

Multiscale representations

(43)

Pyramid

construction

principles

space int ens it y Original signal

(44)

Pyramid

construction

principles

(45)

Pyramid

construction

principles

(46)

Pyramid

construction

principles

(47)

Gaussian and Laplacian Pyramids

Blur and sub-sample

Upsample, error

(48)

Pyramids

Gaussian

(49)

The pyramids have more coefficients than the original

0

1

1

1

4

1

...

4

4 16

3

n

n

¥

=

æ ö = + +

=

ç ÷

è ø

å

Number of coefficients

(50)

Coefficient variance is smaller in Laplacian pyramid

Gaussian pyramid coefficients

References

Related documents

NANOG associates with satellite repeats within heterochromatin domains, contributing to an architecture characterized by highly dispersed chromatin fibers, low levels of H3K9me3,

Where such instruments are not available, and measurements are made in contact with the face of the display, the ambient light should be measured at the viewer position and used

Conventional conversion using ICC profi les yields unsatisfactory results, since they change the color composition: intermediate conversion into the three-color CIELab color

Dedicated ICC profiles allow images recorded with extended color gamut in Adobe RGB color space to be printed using the full color reproduction range of BJ printers.. Printing

4 Number of bits used to indicate the color of a single pixel/dot... smaller file size) and, if so, convert those images to the smaller bit depth type.. l Remove ICC Color Profiles

As terminally ill patients reach lifetime health benefit limits in an employment-based health benefit plan, they may find living benefits attractive since they allow individuals

• High accuracy color adjustment offers color accuracy and consistency • 4- and 6-color PANTONE emulation and ICC profiles assure accurate. color matching, color consistency and

childhood teachers’ attitudes toward providing access for students with disabilities in their classrooms? and 2) How are the attitudes of Montessori and non-Montessori early