15
1 I m a g e Q u a n t i z a t i o n , H a l f t o n i n g , a n d D i t h e r i n g Thomas Funkhouser Princeton University C0S 426, Fall 2000 O v e r v i e w Image representation What is an image? • Quantization Errors due to limited intensity resolution Halftoning and Dithering Reduce effect of quantization errors

Image Quantization, Halftoning, and Dithering

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Image Quantization, Halftoning, and Dithering

1

Image Quantization,Halftoning, and Dithering

Thomas Funkhouser

Princeton University

C0S 426, Fall 2000

Overview

• Image representation� What is an image?

• Quantization� Errors due to limited intensity resolution

• Halftoning and Dithering� Reduce effect of quantization errors

Page 2: Image Quantization, Halftoning, and Dithering

2

What is an Image?

• An image is a 2D rectilinear array of pixels

Continuous image Digital image

What is an Image?

• An image is a 2D rectilinear array of pixels

A pixel is a sample, not a little square!

Continuous image Digital image

Page 3: Image Quantization, Halftoning, and Dithering

3

What is an Image?

• An image is a 2D rectilinear array of pixels

A pixel is a sample, not a little square!

Continuous image Digital image

Image Acquisition

• Pixels are samples from continuous function� Photoreceptors in eye� CCD cells in digital camera� Rays in virtual camera

Page 4: Image Quantization, Halftoning, and Dithering

4

Image Resolution

• Intensity resolution� Each pixel has only “Depth” bits for colors/intensities

• Spatial resolution� Image has only “Width” x “Height” pixels

• Temporal resolution� Monitor refreshes images at only “Rate” Hz

Width x Height Depth Rate NTSC 640 x 480 8 30Workstation 1280 x 1024 24 75Film 3000 x 2000 12 24Laser Printer 6600 x 5100 1 -

Typ

ical

Res

olut

ions

Sources of Error

• Intensity quantization Not enough intensity resolution

• Spatial aliasing Not enough spatial resolution

• Temporal aliasing� Not enough temporal resolution

( )∑ −=),(

22 ),(),(yx

yxPyxIE

Page 5: Image Quantization, Halftoning, and Dithering

5

Overview

• Image representation� What is an image?

• Quantization Errors due to limited intensity resolution

• Halftoning and Dithering� Reduce effect of quantization errors

Quantization

• Artifacts due to limited intensity resolution� Frame buffers have limited number of bits per pixel� Physical devices have limited dynamic range

Page 6: Image Quantization, Halftoning, and Dithering

6

Uniform Quantization

P(x, y) = trunc(I(x, y) + 0.5)

I(x,y)

P(x,

y)

P(x,y)(4 bits per pixel)

I(x,y)

Uniform Quantization

8 bits 4 bits 2 bits 1 bit

Notice contouring

• Images with decreasing bits per pixel:

Page 7: Image Quantization, Halftoning, and Dithering

7

Overview

• Image representation� What is an image?

• Quantization� Errors due to limited intensity resolution

» Halftoning and Dithering� Reduce effects of quantization

Classical Halftoning

• Use dots of varying size to represent intensities� Area of dots proportional to intensity in image

P(x,y)I(x,y)

Page 8: Image Quantization, Halftoning, and Dithering

8

Classical Halftoning

Newspaper Image

From New York Times, 9/21/99

Halftone patterns

• Use cluster of pixels to represent intensity� Trade spatial resolution for intensity resolution

Figure 14.37 from H&B

Page 9: Image Quantization, Halftoning, and Dithering

9

Halftone patterns

• How many intensities in a n x n cluster?

Figure 14.37 from H&B

Overview

• Image representation� What is an image?

• Quantization� Errors due to limited intensity resolution

» Halftoning and Dithering� Reduce effects of quantization

Page 10: Image Quantization, Halftoning, and Dithering

10

Dithering

• Distribute errors among pixels� Exploit spatial integration in our eye� Display greater range of perceptible intensities

UniformQuantization

(1 bit)

Floyd-SteinbergDither(1 bit)

Original(8 bits)

Dithering

• We’ll consider three dithering methods…� Random dither� Ordered dither� Error diffusion dither

Page 11: Image Quantization, Halftoning, and Dithering

11

Random Dither

• Randomize quantization errors� Errors appear as noise

P(x, y) = trunc(I(x, y) + noise(x,y) + 0.5)

I(x,y)

P(x,

y)

I(x,y)

P(x,

y)

Random Dither

UniformQuantization

(1 bit)

Random Dither(1 bit)

Original(8 bits)

Page 12: Image Quantization, Halftoning, and Dithering

12

Ordered Dither

• Pseudo-random quantization errors� Matrix stores pattern of threshholds

i = x mod nj = y mod ne = I(x,y) - trunc(I(x,y))if (e > D(i,j))

P(x,y) = ceil(I(x, y))else

P(x,y) = floor(I(x,y))

=

20

132D

Ordered Dither

• Bayer’s ordered dither matrices

=

20

132D

=

10280

614412

91113

513715

4D

++++

=2

222

22

22

222

2

)2,2(4)1,2(4

)2,1(4)1,1(4

nnnn

nnnn

n UDDUDD

UDDUDDD

Page 13: Image Quantization, Halftoning, and Dithering

13

Ordered Dither

RandomDither(1 bit)

Original(8 bits)

OrderedDither (1 bit)

Error Diffusion Dither

• Spread quantization error over neighbor pixels Error dispersed to pixels right and below

Figure 14.42 from H&B

αβ γ δ

α + β + γ + δ = 1.0

Page 14: Image Quantization, Halftoning, and Dithering

14

Floyd-Steinberg Algorithm

for (x = 0; x < width; x++) {for (y = 0; y < height; y++) {

P(x,y) = trunc(I(x,y) + 0.5)e = I(x,y) - P(x,y)I(x,y+1) += α*e;I(x+1,y-1) += β*e;I(x+1,y) += γ*e;I(x+1,y+1) += δ *e;

}}

Error Diffusion Dither

RandomDither(1 bit)

Original(8 bits)

OrderedDither (1 bit)

Floyd-SteinbergDither (1 bit)

Page 15: Image Quantization, Halftoning, and Dithering

15

Image Processing

• Quantization! Uniform Quantization" Random dither# Ordered dither$ Floyd-Steinberg dither

• Pixel operations% Add random noise& Add luminance' Add contrast( Add saturation

• Filtering) Blur* Detect edges

• Warping+ Scale, Rotate- Warps. Morphs

• Combining/ Composite

Summary

• Image Representation0 An image is a 2D rectilinear array of pixels1 A pixel is a sample, not a little square2 Images have limited resolution

• Quantization3 Errors due to limited intensity resolution

• Halftoning and Dithering4 Reduce effects of quantization5 Distribute errors among pixels

» Exploit spatial integration in our eye» Display greater range of perceptible intensities