11 Sampling and Aliasing
11 Sampling and Aliasing
Today Introduction
Sampling and aliasing • Conceptually, an image is a continuous
• Introduction signal describing the radiance arriving at
• Fourier analysis the image plane
• Understanding sampling and aliasing using • Signal is synonymous for function
Fourier analysis
• Antialiasing in graphics
Introduction Introduction
• Digital images are sampled representations Continuous pixel Sampled pixel
of these continuous signals Sample
• Sampled means “defined only at discrete
locations”, pixel centers
locations
Reconstruct
• Sampling: How to compute the value of
the sampled pixel
• Reconstruction: How to obtain a
continuous image from a set of samples
1
Aliasing Aliasing
Aliasing Aliasing
• Moire patterns
Reconstruct
Insufficiently
• Is it possible to perfectly sample and
sampled
reconstruct an image?
• If yes, under what circumstances?
[R. Cook ]
2
Sampling and aliasing Fourier analysis
• Fourier series: all periodic signals can be
• Goal: understanding sampling and aliasing represented as a summation of sinusoidal
from a „mathematical“ perspective waves
• Tool: Fourier analysis • Sinusoidal wave defined by
– Frequency
– Phase
– Amplitude
[http://axion.physics.ubc.ca/341-02/fourier/fourier.html]
Frequency
Complex amplitude
Sinusoidal wave Inverse Fourier transform
3
Fourier transform example Duality
Spatial Frequency
Spatial domain Frequency domain domain domain
sinc ←⎯→
F
box
box ←⎯→
F
sinc
Duality
cosine (even)
cos(-ωt) =cos(ωt)
• Sifting property
sine (odd)
sin(-ωt) =-sin(ωt)
Period T Period ω0 = 2π / T
4
Convolution Convolution
• In the spatial domain • In the spatial domain
Convolution Convolution
Spatial domain
• In the spatial domain
Convolution
Frequency
domain
5
High-pass filter High-pass filter
• High pass filter: remove low frequencies from
signal
• Shape of high pass filter in spatial and
frequency
q y domain?
Sampling Sampling
• Spatial domain: multiply signal with • Spatial domain: multiply signal with
impulse train impulse train
6
Sampling and reconstruction Sampling and reconstruction
Sampling Reconstruction Sampling Reconstruction
Spatial Domain Frequency Domain Spatial Domain Frequency Domain Spatial Domain Frequency Domain Spatial Domain Frequency Domain
Prefiltering Prefiltering
• Band-limit the continuous signal to the • Not applicable as a general solution in
Nyquist frequency before sampling graphics, since continuous image signal is
• Theoretically the way to go not known
Continuous pixel Sampled pixel • Useful for fexture filtering (mip-mapping)
(mip mapping)
Band-limit Sample
7
Supersampling Supersampling
• Compute several intermediate samples per pixel • Sampling patterns
• Reconstruct final pixel sample from • Reconstruction filters
intermediate samples
Sample Reconstruct
8
Jittered Sampling Jittered vs. Uniform Supersampling
[Hanrahan] [Hanrahan]
Spatial domain Frequency domain [Hanrahan] [Hanrahan]
[Hanrahan] [Hanrahan]
[Dippe 85] [Dippe 85]
Spatial domain Frequency domain
pixel
Sample Reconstruct
frequency
9
Box filter The Ideal Reconstruction Filter
• Ideal reconstruction = ideal low pass filter
• Pixels are not little squares… • Unfortunately, has infinite spatial extent
– Every sample contributes
to every interpolated point
• Expensive/impossible
to compute
• Ringing (Gibbs phenomenon) spatial
frequency
10
Contrast based refinement Refinement strategies
• Refinement if contrast of samples is above • Multi-level sampling
threshold – Use same sampling strategy in each step, but
– Mitchell 1988, http://doi.acm.org/10.1145/37401.37410 increase density
• Perceptually
p y motivated – May repeat two or multiple times
• Contrast Imax − Imin – Mitchell proposes two-stage approach
C=
Imax + Imin
• Use different thresholds for red, green, blue
– Mitchell proposes (0.4, 0.3, 0.6)
– Overly sensitive in dark regions (division by zero)
[Mitchell‚ 1987]
Next time
• Last lecture
11