1 coms 161 introduction to computing title: digital images date: november 12, 2004 lecture number:...

22
1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

Upload: phebe-hunter

Post on 03-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

1

COMS 161Introduction to Computing

Title: Digital Images

Date: November 12, 2004

Lecture Number: 32

Page 2: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

2

Announcements

Page 3: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

3

Review

• Real numbers– Limitations

Page 4: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

4

Outline

• The nature of images– Natural vs. artificial images

• How digital images are– Organized– Created– Stored– Processed

Page 5: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

5

The Nature of Images

• Natural images– From common, analog sources

• Photos, drawings, paintings, TV, movies, etc.

– Must be digitized for use with a computer

• Artificial images– Generated digitally

Page 6: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

6

Representing Digital Images

• Natural images (such as a photograph, a frame of a video, etc.) typically consist of continuous or analog signals

• Digital images are composed of pixels (picture elements)

• For use in a computer, natural images must be digitized

Page 7: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

7

Example of Digitization

• Consider a photograph of a penny – Pretend that this is a

photograph

• To use this image in a computer, it must first be digitized

Page 8: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

8

Example of Digitization

• The first step in digitizing this natural image is sampling

• This image is partitioned (sampled) into a 50×50 square grid of pixels

• The picture resolution of this digitized image will thus be 50×50

Page 9: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

9

Example of Digitization

• An image’s aspect ratio is the ratio of the number of horizontal pixels to the number of vertical pixels– This 50×50 grid has an

aspect ratio of 1:1– Most computer screens

are 1.33:1 • (640×480, 1024×768, etc.)

– Std. TV is 4:3 (or 1.33:1)– HDTV is 16:9 (or 1.78:1)

Page 10: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

10

Example of Digitization

• The second step in digitizing the image is quantizing the pixels

• For each pixel, an average color is calculated

• This resolution (50×50) is ‘clearly’ insufficient to represent the detail of the original image

Page 11: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

11

Resolution

• Picture resolution is a trade-off between image quality and file size

• This digitized image has a resolution of 272×416– Minimum file size is then

(272×416) × (bytes/pixel)– For 256 colors (one byte per

pixel), minimum file size would be (272×416) × (1) = 110.5 KB

– For 16 million colors (3 bytes/pixel), it would be 331 KB

Page 12: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

12

Resolution

• With the resolution reduced to 136×208, the picture loses detail

• File size is reduced to:– 28.3 KB for 256 colors– 84.8 KB for 16 million colors

Page 13: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

13

Resolution

• With the resolution further reduced to 68×104, the picture becomes almost unrecognizable

• File size is greatly reduced to:– 7.1 KB for 256 colors– 21.2 KB for 16 million colors

• With large pictures and high color requirements, file size becomes very important– Digital cameras can easily create

single pictures larger than 1 MB

Page 14: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

14

Quantizing Digital Images

• Imagine a simple image: a bright object on a dark background

• Sample the image as before

• Consider just a single row of pixels across the center

Page 15: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

15

Quantizing Digital Images

• Assign number values to the pixels:

0 = ‘black’1 = ‘white’

• Plot the values of the pixels on the center row

0. 0

0. 5

1. 0

• With this image, we only need two “colors”, black and white

Page 16: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

16

Dynamic Range

• Most pictures are more complex than just black and white

• To adequately represent an image, we need enough levels of quantization to achieve the desired picture quality

• The range of values chosen for quantization is called the dynamic range of the digitized image

Page 17: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

17

Dynamic Range

• Max value – min value

• Typically it is a power of 2– 256 gray values = 28, 8 bits / pixel

• How large should a dynamic range be?– Science says we can only distinguish

between 40 different shades of gray!!

Page 18: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

18

Dynamic Range Example

• This is a grayscale image quantized to 256 levels of gray– 0 = ‘black’– 127 = ‘medium (50%) gray’– 255 = ‘white’

• Dynamic range is sufficient for use in this presentation– Clear detail in highlights and

shadows

Page 19: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

19

Dynamic Range Example

• The same image, now quantized to 16 levels– 0 = ‘black’– 7 = ‘medium (50%) gray’– 15 = ‘white’

• Dynamic range is acceptable– Detail somewhat reduced in

highlights and shadows– False contours becoming

apparent (especially on chin and cheeks)

Page 20: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

20

Dynamic Range Example

• The same image, now quantized to 4 levels– 0 = ‘black’– 1 = ‘dark (67%) gray’– 2 = ‘light (33%) gray’– 3 = ‘white’

• Dynamic range is marginal– Detail severely reduced– Shadows flattened– Extreme false contouring

Page 21: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

21

Dynamic Range Example

• The same image, now quantized to 2 levels– 0 = ‘black’– 1 = ‘white’

• Dynamic range is unacceptable– Detail almost gone– But, this may be a desirable

artistic effect

Page 22: 1 COMS 161 Introduction to Computing Title: Digital Images Date: November 12, 2004 Lecture Number: 32

22

Dynamic Range Example