Lecture 9: Digital Images The Digital World of Multimedia Prof. Mari Ostendorf
Announcements Guest lecture Friday Feb 1 (EEB 403, tentatively) A cultural history of JPEG Dr. Joan Mitchell Another lecture by Dr. Mitchell on Thurs Patenting a wet suit Thurs 1/31 10:30 EEB 125 Lab3 Read the lab *before* lab Do you want to change lab partners once or twice? Send Prof. Ostendorf anonymous email
Goals for Today More on digital images More pixels vs. more bits/sample Gray-scale vs. color Consider the display Image have frequencies too! Foundation for image processing (filtering) and compression
Review: Images vs. Sounds in Bits Sounds: Bits = sec x samples/sec x bits/sample Samples/sec = sampling rate Bits/sample = quantizer resolution Gray-scale images: Bits = inches horizontal x pixels/in (H) x inches vertical x pixels/in (V) x bits/pixel Pixels/in = spatial resolution Bits/pixel = gray scale resolution
Examples of Bit Tradeoffs 1 bpp, 225x300 =8.4KB 8 bpp, 225x300 =540kbits =67.5 k Bytes See Orsak et al. pp. 146-147 8 bpp, 75x100 7.5kB
Bit Allocation Tradeoffs Grayscale: space sampling (pixels/inch) vs. number of gray levels (bits/pixel) Color: same, except now bits/pixel has to be allocated among 3 colors, need not be uniform See book pp.152-153 Other strategies for efficient bit usage: Tricks with color: Orsak et al. pp. 164-168 Compression (more after we learn about frequency)
Grayscale vs. Color Gray: MxN matrix Color: MxNx3 X(i,j,1)=0.75 X(i,j,2)=0.6 X(i,j,3)=1.0 B/W intensity: 0 = black 1 = white X(i,j)=0.4 8 bits/pixel 256 gray levels R/G/B intensity: [0,1]=[none, full] (0,0,0)=black (1,1,1)=white 8 bits/color-pixel 256 3 colors, 24 bits/pixel
Color Digital Images Component colors
Intensity Format Reminder: Intensity is represented in [0,1] range with floating point number (lots of bits) in display BUT, quantized and stored with fewer bits for storage For examples, 8 bits/color usually maps to: 0 0.0 127 0.5 255 1.0 Quiz: Given a color image, if I increase the level by 10 steps (e.g. 0 10, 27 37, etc.) for all colors is the image brighter or darker? Given a grayscale image, if I change the level index using Y(i,j)=255-X(i,j) [or Y(i,j)=1.0-X(i,j)] what will the image look like compared to the original?
Resizing Images Shrinking: Grayscale: replace KxK block with single pixel with average gray level of the K2 pixels in the original Color: Repeat for each color plane Enlarging: Grayscale: insert interpolated pixel values Color: repeat for each color plane, as in shrinking
Image Quality Depends on Skill of photographer Quality of recording device: optics, red-eye preflash, etc. Size of digital image: number of pixels (PPI), bits/pixel (BPI) Digital format: jpg, gif, etc. (see upcoming lectures on compression) Display mechanism (computer screen, printer) in the analog world in the digital world
Color Display: Computer vs. Paper Computer display Sampling: pixels per inch Color: RGB = red, green, blue [true color = 8x3 bits/pixel, 256 3 colors per pixel] Printer display Sampling: dots per inch Color: CMY = cyan, magenta, yellow (+ black) [8 colors per dot] Printer dots not equal to digital pixels So Need higher number of pixels to get good quality prints than for good quality computer display
Halftoning Replace gray-scale image blocks with block that have varying amounts of B/W From: http://fhctech.org/fhc/imaging/halftone.htm
Computer vs. Printed Display Example: I200x1600 pixel digital image On a computer screen with 90PPI: Picture display can be 13.3 x16.7 Allows big display of small part of the image On a reasonable printer with 300DPI: Picture display can be 4 x5.3 QUIZ: In which case(s) do you want to buy a digital camera with lots of megapixels? a) You are using it for building web pages. b) You are using it for taking pictures of people for the class yearbook. c) You are using it for wildlife photography. d) You are using it on a spy mission.
Images have Frequency Too! You can build images out of 2-D cosines just as we build sounds out of 1-D cosines Why is this important: Simplify signal modification Facilitate signal compression Start with just gray-scale to understand concepts to simplify (and since color is just the combination of 3 gray scale images)
Simple Cosines in Time Lower frequency, fewer changes in time Higher frequency, more changes in time
Simple Cosines in Space
Combining Spatial Cosines
More Illustrations of Spatial Frequency
Frequency Content of Natural Time Signals AE in ballot, periodic S in first, aperiodic
Frequency Content of Images