Image Processing and Sampling Aaron Bloomfield CS 445
Image Processing and Sampling Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
Overview n Image representation n n What is an image? Halftoning and dithering n n Trade spatial resolution for intensity resolution Reduce visual artifacts due to quantization
What is an Image? n An image is a 2 D rectilinear array of pixels Continuous image Digital image
What is an Image? n An image is a 2 D rectilinear array of pixels Continuous image Digital image A pixel is a sample, not a little square!
What is an Image? n An image is a 2 D rectilinear array of pixels Continuous image Digital image A pixel is a sample, not a little square!
Image Acquisition n Pixels are samples from continuous function n Photoreceptors in eye CCD cells in digital camera Rays in virtual camera
Image Display n Re-create continuous function from samples n Example: cathode ray tube Image is reconstructed by displaying pixels with finite area (Gaussian)
Image Resolution Intensity resolution n n Spatial resolution n n Each pixel has only “Depth” bits for colors/intensities Image has only “Width” x “Height” pixels Temporal resolution n Monitor refreshes images at only “Rate” Hz Typical Resolutions n NTSC Workstation Film Laser Printer Width x Height 640 x 480 1280 x 1024 3000 x 2000 6600 x 5100 Depth 8 24 12 1 Rate 30 75 24 -
Sources of Error n Intensity quantization n n Spatial aliasing n n Not enough intensity resolution Not enough spatial resolution Temporal aliasing n Not enough temporal resolution
Overview n Image representation n Ø What is an image? Halftoning and dithering n Reduce visual artifacts due to quantization
Quantization n Artifacts due to limited intensity resolution n n Frame buffers have limited number of bits per pixel Physical devices have limited dynamic range
Uniform Quantization P(x, y) = trunc(I(x, y) + 0. 5) P(x, y) I(x, y) P(x, y) (2 bits per pixel)
Uniform Quantization n Images with decreasing bits per pixel: 8 bits 256 bpp 4 bits 32 bpp 2 bits 8 bpp 1 bit 2 bpp
Reducing Effects of Quantization n Halftoning n n Classical halftoning Dithering n n n Error diffusion dither Random dither Ordered dither
Classical Halftoning n Use dots of varying size to represent intensities n Area of dots proportional to intensity in image I(x, y) P(x, y)
Classical Halftoning Newspaper image from North American Bridge Championships Bulletin, Summer 2003
Halftone patterns n Use cluster of pixels to represent intensity n Trade spatial resolution for intensity resolution Figure 14. 37 from H&B
Dithering n Distribute errors among pixels n n n Uniform quantization discards all errors n n Exploit spatial integration in our eye Display greater range of perceptible intensities i. e. all “rounding” errors Dithering is also used in audio, by the way
Floyd-Steinberg dithering n Any “rounding” errors are distributed to other pixels n Specifically to the pixels below and to the right n n n 7/16 of the error to the pixel to the right 3/16 of the error to the pixel to the lower left 5/16 of the error to the pixel below 1/16 of the error to the pixel to the lower right Assume the 1 in the middle gets “rounded” to 0
Error Diffusion Dither n Spread quantization error over neighbor pixels n Error dispersed to pixels right and below + + + = 1. 0 Figure 14. 42 from H&B
Floyd-Steinberg dithering n Floyd-Steinberg dithering is a specific error dithering algorithm Original (8 bits) Uniform Quantization (1 bit) Floyd-Steinberg Dither (1 bit) (pure B&W)
Random Dither Randomize quantization errors Errors appear as noise P(x, y) n I(x, y) P(x, y) = trunc(I(x, y) + noise(x, y) + 0. 5)
Random Dither Original (8 bits) Uniform Quantization (1 bit) Random Dither (1 bit)
Ordered Dither n Pseudo-random quantization errors n Matrix stores pattern of thresholds i = x mod n j = y mod n e = 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))
Ordered Dither n Bayer’s ordered dither matrices n Reflections and rotations of these are used as well
Ordered Dither Original (8 bits) Uniform Quantization (1 bit) 4 x 4 Ordered Dither (1 bit)
Dither Comparison Original (8 bits) Random Dither (1 bit) Ordered Dither (1 bit) Floyd-Steinberg Dither (1 bit)
Color dithering comparison Original image Optimized 256 color palette FS dithering Web-safe palette, no dithering Optimized 16 color palette No dithering Web-safe palette, FS dithering Optimized 16 color palette FS dithering
Summary n Image representation n A pixel is a sample, not a little square Images have limited resolution Halftoning and dithering n n Reduce visual artifacts due to quantization Distribute errors among pixels n n Exploit spatial integration in our eye Sampling and reconstruction n n Reduce visual artifacts due to aliasing Filter to avoid undersampling n Blurring is better than aliasing
- Slides: 29