Image Processing and Sampling
description
Transcript of Image Processing and Sampling
![Page 1: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/1.jpg)
Image Processing and Sampling
Aaron Bloomfield
CS 445: Introduction to Graphics
Fall 2006
![Page 2: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/2.jpg)
Overview
Image representation What is an image?
Halftoning and dithering Trade spatial resolution for intensity resolution Reduce visual artifacts due to quantization
![Page 3: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/3.jpg)
What is an Image?
An image is a 2D rectilinear array of pixels
Continuous image Digital image
![Page 4: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/4.jpg)
What is an Image?
An image is a 2D rectilinear array of pixels
Continuous image Digital image
A pixel is a sample, not a little square!A pixel is a sample, not a little square!
![Page 5: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/5.jpg)
What is an Image?
An image is a 2D rectilinear array of pixels
A pixel is a sample, not a little square!A pixel is a sample, not a little square!
Continuous image Digital image
![Page 6: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/6.jpg)
Image Acquisition
Pixels are samples from continuous function Photoreceptors in eye CCD cells in digital camera Rays in virtual camera
![Page 7: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/7.jpg)
Image Display
Re-create continuous function from samples Example: cathode ray tube
Image is reconstructedby displaying pixels
with finite area(Gaussian)
![Page 8: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/8.jpg)
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
ica
lR
eso
lutio
ns
![Page 9: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/9.jpg)
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 10: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/10.jpg)
Overview
Image representation What is an image?
Halftoning and dithering Reduce visual artifacts due to quantization
![Page 11: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/11.jpg)
Quantization
Artifacts due to limited intensity resolution Frame buffers have limited number of bits per pixel Physical devices have limited dynamic range
![Page 12: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/12.jpg)
P(x, y) = trunc(I(x, y) + 0.5)
I(x,y)
P(x
,y)
P(x,y)(2 bits per pixel)
I(x,y)
Uniform Quantization
![Page 13: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/13.jpg)
Uniform Quantization
8 bits 4 bits 2 bits 1 bit
Images with decreasing bits per pixel:
256 bpp 32 bpp 8 bpp 2 bpp
![Page 14: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/14.jpg)
Reducing Effects of Quantization
Halftoning Classical halftoning
Dithering Error diffusion dither Random dither Ordered dither
![Page 15: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/15.jpg)
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 16: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/16.jpg)
Classical Halftoning
Newspaper image from North American Bridge Championships Bulletin, Summer 2003
![Page 17: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/17.jpg)
Halftone patterns
Use cluster of pixels to represent intensity Trade spatial resolution for intensity resolution
Figure 14.37 from H&B
![Page 18: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/18.jpg)
Dithering
Distribute errors among pixels Exploit spatial integration in
our eye Display greater range of
perceptible intensities Uniform quantization
discards all errors i.e. all “rounding” errors
Dithering is also used in audio, by the way
![Page 19: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/19.jpg)
Floyd-Steinberg dithering
Any “rounding” errors are distributed to other pixels Specifically to the pixels below and to the right
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
00.000.000.0
00.000.100.0
00.000.000.0 0.00 0.00 0.00
0.00 0.00 0.44
0.19 0.31 0.06
![Page 20: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/20.jpg)
Error Diffusion Dither
Spread quantization error over neighbor pixels Error dispersed to pixels right and below
Figure 14.42 from H&B
![Page 21: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/21.jpg)
Floyd-Steinberg dithering
Floyd-Steinberg dithering is a specific error dithering algorithm
UniformQuantization
(1 bit)
Floyd-SteinbergDither (1 bit)
Original(8 bits)
Floyd-Steinberg
Dither (1 bit)(pure B&W)
![Page 22: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/22.jpg)
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)
![Page 23: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/23.jpg)
Random Dither
UniformQuantization
(1 bit)
RandomDither(1 bit)
Original(8 bits)
![Page 24: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/24.jpg)
Ordered Dither
Pseudo-random quantization errors Matrix stores pattern of thresholds
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
![Page 25: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/25.jpg)
Ordered Dither
Bayer’s ordered dither matrices Reflections and rotations of these are used as well
20
132D
10280
614412
91113
513715
4D
22
222
2
22
222
2
)2,2(4)1,2(4
)2,1(4)1,1(4
nnnn
nnnn
n UDDUDD
UDDUDDD
![Page 26: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/26.jpg)
Ordered Dither
UniformQuantization
(1 bit)
4x4 OrderedDither(1 bit)
Original(8 bits)
![Page 27: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/27.jpg)
Dither Comparison
RandomDither(1 bit)
Original(8 bits)
OrderedDither (1 bit)
Floyd-SteinbergDither (1 bit)
![Page 28: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/28.jpg)
Color dithering comparison
Original image Web-safe palette, no dithering Web-safe palette, FS dithering
Optimized 256 color palette Optimized 16 color palette Optimized 16 color palette
FS dithering No dithering FS dithering
![Page 29: Image Processing and Sampling](https://reader036.fdocuments.us/reader036/viewer/2022062309/56815a65550346895dc7b03c/html5/thumbnails/29.jpg)
Summary
Image representation A pixel is a sample, not a little square Images have limited resolution
Halftoning and dithering Reduce visual artifacts due to quantization Distribute errors among pixels
Exploit spatial integration in our eye
Sampling and reconstruction Reduce visual artifacts due to aliasing Filter to avoid undersampling
Blurring is better than aliasing