Aliasing
Aliasing
Sampling: Convert continuous to discrete Reconstruction: Converting from discrete to continuous Aliasing: Artifacts arising from sampling and consequent loss of information Anti-aliasing: Attempts to overcome aliasing
Slide 1 Lecture 13
Copyright
Amitabh Varshney
Sampling
Occurs when the sampling inherent in rendering does not contain enough information for an accurate image.
Original Scene Sampling Pixel Centres Rendered Image
Scanline Luminosity
Sampled Signal
Luminosity Signal
Slide 2
Lecture 13
Copyright
Amitabh Varshney
Slide 3
Lecture 13
Copyright
Amitabh Varshney
Effects of Aliasing
Common aliasing errors (called artefacts) are: jagged profiles, disappearing or improper fine detail, and disintegrating textures.
Jagged Profiles
Loss of Detail
Slide 4
Lecture 13
Copyright
Amitabh Varshney
Jaggies
Slide 5
Lecture 13
Copyright
Amitabh Varshney
Moire Patterns
Slide 6
Lecture 13
Copyright
Amitabh Varshney
Moire Patterns
Amitabh Varshney
Moire Patterns
Amitabh Varshney
Disintegrating Texture
The checkers on a plane should become smaller with distance. But aliasing causes them to become larger and/or irregular. Increasing resolution only moves the artefact closer to the horizon.
Slide 9
Lecture 13
Copyright
Amitabh Varshney
Temporal Aliasing
A A A A A
Amitabh Varshney
Image as a 2D Signal
Slide 11
Image from Computer Graphics: Principles and Practice by Foley, van Dam, Feiner, and Hughes Lecture 13
Copyright
Amitabh Varshney
Fourier Series
Analytic geometry gives a coordinate system for describing geometric objects. Fourier series gives a coordinate system for functions.
Slide 12
Lecture 13
Copyright
Amitabh Varshney
Basis
Note, Im showing non-standard basis, these are from basis using Lecture 13 complex functions.
Copyright
Amitabh Varshney
Fourier Analysis
Represent a function as a weighted sum of sines
Image from Computer Graphics: Principles and Practice by Foley, van Dam, Feiner, and Hughes Slide 14 Lecture 13
Copyright
Amitabh Varshney
Example
Slide 15
Lecture 13
Copyright
Amitabh Varshney
Orthonormal Basis
||(1,0)||=||(0,1)||=1 (1,0).(0,1)=0 Similarly we use normal basis elements eg:
cos( ) cos( )
cos()
cos d
2 2 0
Lecture 13
cos cos 2 d 0
Copyright
Amitabh Varshney
x ( x, y ) (1,0) ( x, y ) x(1,0)
2
ai ,1 f
Slide 17
cos i f* ai , 2 d cos i
ai ,1
cos i cos i
ai , 2
Lecture 13
sin i sin i
a0 , 0
Copyright Amitabh Varshney
2D Example
Slide 18
Lecture 13
Slide 19
Lecture 13
Slide 20
Lecture 13
10
The Fourier basis allows us to see which part of the image is causing trouble. The high frequency harmonics. Well get rid of these.
Slide 21 Lecture 13
Copyright Amitabh Varshney
Convolution
This is a very general concept But in this class, well just talk about convolutions that perform smoothing. Averaging: replace each pixel by the average in its neighborhood.
This can be done for continuous images with an integral
11
Weighted Average
We define a set of weights, w-k, w-k+1, , w-1,w0, w1,, wk. Then, smooth g by: k wi g ( x i ) This set of weights is a filter. i k For simple average, all w = 1/(2k+1) Other common alternative is to pick w from Normal (Gaussian) distribution.
Slide 23
Lecture 13
Convolution Theorem
g T F *G
1
f is a description of the weights in the weighted average (the filter), g is the image. F,G are transform of f,g That is, F contains coefficients, when we write f as linear combinations of harmonic basis. This says convolution is equivalent to multiplication in the transform domain. 24 Lecture 13
Slide
12
Examples
Transform of box filter is sinc. Transform of Gaussian is Gaussian.
Slide 25
Lecture 13
Implications
Smoothing a sine or cosine just scales it (reduces amplitude). Smoothing a high frequency sine or cosine reduces its amplitude more than smooth a low frequency one. Smoothing an image reduces high frequencies more than low ones. Sinc function explains artifacts. Need smoothing before subsampling to avoid aliasing.
Slide 26 Lecture 13
Copyright Amitabh Varshney
13
Sampling
Every sample gives a linear equation in ai,j. Need two samples for every frequency.
Slide 27 Lecture 13
Copyright Amitabh Varshney
Previous examples
Disintegrating Texture
As squares get small, frequency grows. At some point, sampling is slower than frequency of changes.
Wagon wheel.
As wheel moves fast, we cannot sample world that fast.
Slide 28 Lecture 13
14
Solutions:
Prefiltering: Lower the maximum frequency (filter out high frequencies) Super Sampling: Raise the sampling frequency Stochastic Sampling: Sample randomly instead of uniformly
Slide 29 Lecture 13
15
Slide 31
Lecture 13
Gaussian Averaging
Rotationally symmetric. Weights nearby pixels more than distant ones.
This makes sense as probabalistic inference.
Slide 32
Lecture 13
16
Slide 33
Lecture 13
17
Prefiltering
Blur the images by some low-pass filters Easy for 2D text, images, and 2D graphics Difficult for 3D graphics (visibility is an issue since translucency is expensive)
Slide 36
Lecture 13
18
Prefiltering
+ No Antialiasing Prefiltering
Slide 37
Lecture 13
Increasing Resolution
Physically increase the display resolution
Not always possible
19
Slide 39
Matlab Lecture 13
Slide 40
Lecture 13
20
Stochastic Sampling
Sample at a random place within the pixel to determine its color (Jittering) Pick a random point and keep it if its nearest neighbor is > r units away (Poisson Disk Sampling) Often use stochastic sampling with supersampling (eg: 16 stochastic samples/pixel) Reduces aliasing at the cost of added noise.
Slide 41 Lecture 13
Copyright Amitabh Varshney
Averaging: use an n x n filter to assign weights to each sample. Sum all the weighted samples to obtain a pixel.
Slide 42 Lecture 13
1 16 1 8 1 16
1 8 1 4 1 8
1 16 1 8 1 16
21
Filtering Example
Slide 43
Lecture 13
Slide 44
Lecture 13
22
Antialiasing Examples
Slide 45
Lecture 13
Antialiasing Examples
Slide 46
Lecture 13
23
Antialiasing Examples
Slide 47
Lecture 13
Antialiasing Examples
Slide 48
Lecture 13
24