1Image ProcessingTom FunkhouserPrinceton UniversityCOS 426, Spring 2006Image 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 Warp• Combining Composite MorphWhat is an Image?• An image is a 2D rectilinear array of samplesContinuous image Digital imageImage 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” HzWidth 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 -TypicalResolutionsSources of Error• Intensity quantization Not enough intensity resolution• Spatial aliasing Not enough spatial resolution• Temporal aliasing Not enough temporal resolution()−=),(22),(),(yxyxPyxIEOverview• Image representation What is an image? Halftoning and dithering Reduce visual artifacts due to quantization• Sampling and reconstruction Reduce visual artifacts due to aliasing2Quantization• Artifacts due to limited intensity resolution Frame buffers have limited number of bits per pixel Physical devices have limited dynamic rangeUniform QuantizationP(x, y) = round( I(x, y) )where round() chooses nearestvalue that can be represented.I(x,y)P(x,y)P(x,y)(2 bits per pixel)I(x,y)Uniform Quantization8 bits 4 bits 2 bits 1 bit Notice contouring.• Images with decreasing bits per pixel:Reducing Effects of Quantization• Dithering Random dither Ordered dither Error diffusion dither• Halftoning Classical halftoningDithering• Distribute errors among pixels Exploit spatial integration in our eye Display greater range of perceptible intensitiesUniformQuantization(1 bit)Floyd-SteinbergDither(1 bit)Original(8 bits)Random Dither• Randomize quantization errors Errors appear as noiseP(x, y) = round( I(x, y) + noise(x,y) )I(x,y)P(x,y)I(x,y)P(x,y)3Random DitherUniformQuantization(1 bit)Random Dither(1 bit)Original(8 bits)Ordered Dither• Pseudo-random quantization errors Matrix stores pattern of threshholdsi = x mod nj = y mod ne = I(x,y) - trunc(I(x,y))threshold = (D(i,j)+1)/(n2+1)if (e > threshold)P(x,y) = ceil(I(x, y))else P(x,y) = floor(I(x,y)) =20132D0 11/5 2/5 3/5 4/5thresholdsOrdered Dither• Bayer’s ordered dither matrices =20132D =10280614412911135137154D ++++=222222222222)2,2(4)1,2(4)2,1(4)1,1(4nnnnnnnnnUDDUDDUDDUDDDOrdered DitherRandomDither(1 bit)Original(8 bits)OrderedDither (1 bit)Error Diffusion Dither• Spread quantization error over neighbor pixels Error dispersed to pixels right and belowFigure 14.42 from H&Bαβγ δα + β + γ + δ = 1.0Error Diffusion DitherRandomDither(1 bit)Original(8 bits)OrderedDither (1 bit)Floyd-SteinbergDither (1 bit)4Reducing Effects of Quantization• Dithering Random dither Ordered dither Error diffusion dither Halftoning Classical halftoningClassical Halftoning• Use dots of varying size to represent intensities Area of dots proportional to intensity in imageP(x,y)I(x,y)Classical HalftoningFrom Town Topics, PrincetonHalftone patterns• Use cluster of pixels to represent intensity Trade spatial resolution for intensity resolutionFigure 14.37 from H&BQ: In this case, would we use four “halftoned” pixels in place of one original pixel?Overview• Image representation What is an image?• Halftoning and dithering Reduce visual artifacts due to quantization Sampling and reconstruction Reduce visual artifacts due to aliasingWhat is an Image?• An image is a 2D rectilinear array of samplesContinuous image Digital image5Sampling and ReconstructionSamplingReconstructionSampling and ReconstructionFigure 19.9 FvDFHImage 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• Combining Composite MorphAdjusting Brightness• Simply scale pixel components Must clamp to range (e.g., 0 to 255) Original BrighterAdjusting Contrast• Compute mean luminance for all pixels luminance = 0.30*r + 0.59*g + 0.11*b• Scale deviation from for each pixel component Must clamp to range (e.g., 0 to 255) Original More ContrastImage 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• Combining Composite Morph6Image Processing• Consider reducing the image resolutionOriginal image 1/4 resolutionImage ProcessingResampling• Image processing is a resampling problemThou shalt avoid aliasing!Thou shalt avoid aliasing!Aliasing• In general: Artifacts due to under-sampling or poor reconstruction• Specifically, in graphics: Spatial aliasing Temporal aliasingFigure 14.17 FvDFHUnder-samplingSpatial Aliasing• Artifacts due to limited spatial resolutionSpatial Aliasing• Artifacts due to limited spatial resolution“Jaggies”Temporal Aliasing• Artifacts due to limited temporal resolution Strobing Flickering7Temporal Aliasing• Artifacts due to limited temporal resolution Strobing FlickeringTemporal Aliasing• Artifacts due to limited temporal resolution Strobing FlickeringTemporal Aliasing• Artifacts due to limited temporal resolution Strobing FlickeringSampling Theory• When does aliasing happen? How many samples are required to represent a given signal without loss of information? What signals can be reconstructed without loss for a given sampling rate?Spectral Analysis• Spatial domain: Function: f(x) Filtering: convolution• Frequency domain: Function: F(u) Filtering: multiplicationAny signal can be written as a sum of periodic functions.Fourier TransformFigure 2.6 Wolberg8Fourier Transform∞∞−−= dxexfuFxuiπ2)()(∞∞−+= dueuFxfuxiπ2)()(• Fourier
View Full Document