sampling and reconstruction - cgl @ ethz7. anti-aliasing 21 effects of sampling 7. anti-aliasing 22...
TRANSCRIPT
7. An
ti-Alia
sing 2
Mo
tivatio
n
•T
he m
ain
go
al o
f Co
mp
uter G
rap
hics is to
gen
erate
2D im
ag
es
•2D
ima
ge
s are co
ntin
uo
us
2D fu
nctio
ns
(or sig
na
ls)
–m
on
och
rom
ef(x,y)
–o
r colo
rr(x,y), g(x,y), b(x,y)
•T
hese
fun
ction
s are
rep
rese
nted
by a
2D
set o
f discrete sa
mp
les(p
ixe
ls)
•Sa
mp
ling
can
cau
se a
rtifacts
(=A
liasin
g)
7. An
ti-Alia
sing 3
Sam
plin
g a
nd
Reco
nstru
ction
sam
plin
g
(alia
sing
pro
blem
s)
recon
structio
n
(filterin
g)
7. An
ti-Alia
sing 4
Exa
mp
les -M
oiré
Pa
tterns
7. An
ti-Alia
sing 5
Exa
mp
les -Ja
gg
ies
•Sta
ircase e
ffect a
t bo
rde
rs
7. An
ti-Alia
sing 6
Tem
po
ral A
liasin
g
rea
l (con
tinu
ou
s) mo
tion
sam
pled
(perce
ived
) mo
tion
time
7. An
ti-Alia
sing 7
Alia
sing
in C
om
pu
ter Gra
ph
ics
•A
liasin
g e
ffects:
–lo
ss of d
etail
–M
oiré
pa
ttern
s
–ja
gg
ies
•A
pp
ea
r in
–tex
ture m
ap
pin
g
–sca
n co
nve
rsion
of g
eo
me
try
–ra
ytracin
g
7. An
ti-Alia
sing 8
Sign
al P
rocessin
g
•A
liasin
g is w
ell u
nd
erstoo
d in
sign
al p
roce
ssing
•In
terpret im
ag
es a
s 2D sig
na
ls
•A
liasin
g =
sam
plin
g o
f L2-fu
nctio
ns b
elo
wth
e
Nyq
uist
freq
uen
cyu
Nyquist =
2 usignal
7. An
ti-Alia
sing 9
Spectru
m o
f an
Ima
ge
•W
ha
t is usignal o
f an
ima
ge f(x,y)?
•U
se Fo
urie
r an
alysis
(1D first)
•R
ep
rese
nt f(x)
as a
sum
of h
arm
on
ic wa
ves:
{}
∫ ∞∞−
−=
=dx
ef(x)
F(u)f(x)
Fx
uπj2
∫ ∞∞−
=du
eF(u)
f(x)x
uπj2
•T
he a
mp
litud
es F(u)
of w
aves w
ith
freq
ue
ncy u
(spe
ctrum
) are
com
pu
ted
as
7. An
ti-Alia
sing 10
Avo
idin
g A
liasin
g
•Let W
be th
e ma
xim
um
ufo
r wh
ich |F(u)|>
0•
Eith
er ch
oo
se usam
pling> 2W
•O
r zero a
ll F(u)fo
r u >½
usam
pling
•i.e. lo
w p
ass filter th
e sig
na
l
•Sm
oo
thin
g o
f ima
ge
be
fore sa
mp
ling
!
•e.g
. Mip
ma
pp
ing
:
de
crea
sing
sam
plin
g ra
te, in
crea
sed sm
oo
thin
g
7. An
ti-Alia
sing 11
1D Fo
urier T
ran
sform
•Fo
urie
r tran
sform
{}
∫ ∞∞−
−=
=dx
ef(x)
F(u)f(x)
Fx
uπj2
{}
∫ ∞∞−
==
due
F(u)f(x)
F(u)F
xuπ
j-
21
•In
verse
tran
sform
7. An
ti-Alia
sing 12
1D D
iscrete Fou
rier Tra
nsfo
rm
∑−=
−=
10
21
Ni
Nik
πj
ef(i)
NF(k)
∑−=
=10
2Nk
Nik
πj
eF(k)
f(i)
•D
iscrete
tran
sform
•D
iscrete inverse
πu∆
x∆4 1
≥⋅
•H
eisen
berg
reso
lutio
n b
ou
nd
s
uk
ux
ix
∆⋅=
∆⋅=
,
7. An
ti-Alia
sing 13
2D Fo
urier T
ran
sform
s
{}
{}
∫∫
∫∫∞∞−
∞∞−
+
∞∞−
∞∞−
+−
==
==
dvdu
ef(x,y)
f(x,y)F(u,v)
F
dydx
ef(x,y)
F(u,v)f(x,y)
F
y)v
x(uπ
j-
y)v
x(uπ
j
21
2
•D
iscrete setting∑
∑ −=
−=
+−
=10
10
21
Mx
Ny
)N yv
M xu(π
je
f(x,y)N
MF(u,v)
∑∑ −=
−=
+=
10
10
2Mu
Nv
)N yv
M xu(π
je
F(u,v)f(x,y)
7. An
ti-Alia
sing 14
Exa
mp
le:2
D Fo
urier T
ran
sform
s
rect(x,y
)sin
c(x,y
)
otherwise
0/)
sin(1
)(
sinc=
=
xx
xx
sine
card
ina
l or
sam
plin
g fu
nctio
n:
7. An
ti-Alia
sing 15
Reco
nstru
ction
xx
ix
gx
if
f(x)Ni
∆⋅∆
−⋅
∆=∑
=1)
()
(
x
g(x)
x
f(i ∆x)
∆xreco
nstru
ction
filter
x
f(x)
∫ ∞∞−
−=
dαα)
g(xf(α
f(x)*g(x))
•C
on
tinu
ou
s case
(con
volu
tion
)7. A
nti-A
liasin
g 16
Co
nvo
lutio
ns
•Fo
r real fu
nctio
ns
∫ ∞∞−
−=
dαα)
g(xf(α
f(x)*g(x))
x
f(x)
x
g(x)
αx g(x-α)
f(α)
f(x)dα
α)(x
f(α(x)
f(x)*=
−=∫ ∞∞−
δδ
)
x
δ(x)
7. An
ti-Alia
sing 17
Co
nvo
lutio
ns
•C
on
volu
tion
of co
mp
lex fu
nctio
ns
•D
iscrete setting
•2
D co
nvo
lutio
n a
s a sep
ara
ble
TP
-exten
sion
∫ ∞∞−
−=
dαα)
(xg
f(αf(x)*g(x)
)
∑−=
−=
10
Mme
ee
em
)(x
g(m
)f
(x)(x)*g
f
dβdα
β)α,y
(xg
β)f(α
,y)f(x,y)*g(x
∫∫ ∞∞−
∞∞−
−−
=,
g(x)(x)
g
ofcom
plex
conjugate :
7. An
ti-Alia
sing 18
Co
nvo
lutio
ns
•D
iscrete form
∑∑ −=
−=
−−
=10
10
Mm
Nne
ee
en)
m,y
(xg
(m,n)
f(x,y)
(x,y)*gf
•C
on
volu
tion
the
ore
m
G(u)
F(u)f(x)*g(x)≡∫ ∞∞−
∞<
==
dxf(x)
f,ff
22
•Fo
r fun
ction
of fin
ite energ
y(L
2)
*G(u)
F(u)f(x)g(x)≡
7. An
ti-Alia
sing 19
Sam
plin
g a
nd
Discretiza
tion
•S
am
plin
g a
fun
ction
–δ: D
irac
Delta
distrib
utio
n
•S
am
plin
g ra
te a
s a fu
nctio
n o
f up
per b
an
d
limit W
•N
yqu
istR
ate
∫ ∞∞−
−=
dx)
xδ(x
f(x))
f(x0
0
Wx∆
2 1≤
Wx∆
21
=
7. An
ti-Alia
sing
20
Alia
sing
•Sa
mp
ling
= m
ultip
licatio
n w
ith seq
uen
ce o
f d
elta fu
nctio
ns (im
pu
lse train
)
•M
ultip
licatio
n co
nve
rts to co
nvo
lutio
n in
Fo
urier d
om
ain
•C
on
volu
tion
with
seq
ue
nce o
f de
lta fu
nctio
ns
= p
eriod
izatio
n
•O
verla
p o
f Fou
rier tran
sform
s lea
ds to
alia
sing
•R
econ
structio
n =
Low
pa
ss filtering
7. An
ti-Alia
sing 21
Effects of Sa
mp
ling
7. An
ti-Alia
sing 22
Rip
plin
g
≤
≤=
else0
01
Xx
h(x)
bo
un
ded
fu
nctio
ns:
7. An
ti-Alia
sing 23
Discrete Fo
urier T
ran
sform
x∆N
u∆1
=
7. An
ti-Alia
sing 24
Alia
sing
-free Reco
nstru
ction
Spa
tial D
om
ain
Frequ
ency D
om
ain
Spa
tial D
om
ain
Frequ
ency D
om
ain
7. An
ti-Alia
sing 25
Occu
rrence o
f Alia
sing
Spa
tial D
om
ain
Frequ
en
cy Do
ma
inSp
atia
l Do
ma
inFreq
ue
ncy D
om
ain
7. An
ti-Alia
sing 26
2D
Sam
plin
g
•2
D im
pu
lse fields
∫∫ ∞∞−
∞∞−
=−
−)
,yf(x
dydx
)y
,yx
δ(xf(x,y)
00
00
7. An
ti-Alia
sing 27
Fou
rier Do
ma
in
•P
erio
dic sp
ectru
m o
f ba
nd
limite
d
sam
ple
d fu
nctio
n
7. An
ti-Alia
sing 28
Reco
nstru
ction
–A
ntia
liasin
g
•W
ind
ow
ing
spe
ctrum
usin
g filters
•Sim
ple
[]
= =
else0
of
Box
B
ounding w
ithin 1
where
R(u,v)
G(u,v)
,v)S(u,v)*F(u
G(u,v)
f(x,y)
7. An
ti-Alia
sing 29
2D
Sam
plin
g T
heo
rem
•S
am
plin
g ra
te is b
ou
nd
ed b
y
•Fin
ite, discrete
setting
y∆
Nv∆
x∆N
u∆
1 1
= =
v u
Wy
∆
Wx∆
2 1 2 1
≤ ≤
7. An
ti-Alia
sing
30
Spectra
l An
alysis o
f Mesh
es
7. An
ti-Alia
sing 31
An
tialia
sing
Filters in P
ractice
•P
rop
erties o
f a g
oo
d lo
w p
ass filte
r
7. An
ti-Alia
sing 32
An
tialia
sing
Filters
•B
-Sp
line
filters of o
rde
r n
•In
crea
se o
rder b
y repe
ated
con
volu
tion
fc
fπ
fπ
ω/ ω
/x x
(x)g
sinsin
2 2sin
2 10
2 11
1=
=↔
> ≤=
fc
(x)*g
(x)*(x)*g
g(x)
gn
nsin
11
1↔
=K
7. An
ti-Alia
sing 33
An
tialia
sing
Filters
•G
au
ssian
filters
•Sin
c-filter
> ≤
=↔
=c c
c
cc
gxx
sinx
sincω
ωω
ωω ω
ωω
0 12
1)
()
()
(π
π
)(
)(
)(
ωσ π
ω
πσ
/σ
/ω
σσ
σ/
σ2
22
22
2
2
1 2
22
2 1
g
eG
ex
gx
= =↔
=
−
−
7. An
ti-Alia
sing 34
Filters an
d Fo
urier T
ran
sform
s
7. An
ti-Alia
sing 35
Filtering
in T
extu
re Spa
cea
nd
Screen Sp
ace
7. An
ti-Alia
sing 36
The C
on
cept o
f Resa
mp
ling
Filters
•P
erspe
ctive pro
jectio
n o
f a tex
ture
d su
rface
•N
on
-un
iform
sam
plin
g p
attern
on
screen
•O
ptim
al re
sam
plin
gfilter is sp
atia
llyva
rian
t
7. An
ti-Alia
sing 37
Pro
jection
an
d Im
ag
e Wa
rpin
g
Affin
e Ma
pp
ing
Pro
jective Ma
pp
ing
7. An
ti-Alia
sing 38
1.
Rela
tion
s betw
een T
extu
re an
d
Ima
ge Sp
ace
wa
rp
2.3.
4.
Te
xtu
re sp
ace
Ima
ge
spa
ce
7. An
ti-Alia
sing 39
Spa
tially
Va
rian
t Filtering
Screen Sp
ace
Textu
re Spa
ce
7. An
ti-Alia
sing
40
An
tialia
sing
in R
ay
tracin
g
Pix
el
•Su
persa
mp
ling
7. An
ti-Alia
sing 41
Jittering
•R
an
do
m P
erturb
atio
n o
f Sam
plin
g P
ositio
ns
7. An
ti-Alia
sing 42
Po
isson
Sam
plin
g vs.Jitterin
g
7. An
ti-Alia
sing 43
Sup
ersam
plin
g&
Jittering
4R
ay
s/Pix
elJitter=0.3
7. An
ti-Alia
sing 44
Sup
ersam
plin
g&
Jittering
Jitter=0.5Jitter=1.0
7. An
ti-Alia
sing 45
4R
ay
s/Pix
elJitter=0.3
Sup
ersam
plin
g&
Jittering
7. An
ti-Alia
sing
46
Sup
ersam
plin
g&
Jittering
Jitter=0.5Jitter=1.0
7. An
ti-Alia
sing 47
Ad
ap
tive Sup
ersam
plin
g
7. An
ti-Alia
sing 48
Ad
ap
tive Sup
ersam
plin
g