Lec04 Transformations
Lec04 Transformations
?
What is the geometric relationship
between these two images?
x x
x x
Richard Szeliski Image Stitching 8
Image Warping
• image filtering: change range of image
• g(x) = h(f(x))
f g
h
p = (x,y) p’ = (x’,y’)
(0,0) (0,0)
θ
(0,0) (0,0)
(x/w, y/w, 1)
w=1
x
homogeneous image
coordinates
y
any transformation
represented by a 3x3
matrix with last row [ 0
0 1 ] we call an affine
transformation
Basic affine transformations
x' 1 0 t x x x ' s x 0 0 x
y ' 0 1 t y y ' 0 sy 0 y
y
1 0 0 1 1 1 0 0 1 1
Translate Scale
Called a homography
(or planar perspective
map)
Homographies
What happens
when the
denominator is 0?
Points at infinity
Image warping with homographies
T(x,y
y y’
)
x x’
f(x,y g(x’,y’
) )
Forward Warping
• Send each pixel (x,y) to its corresponding location
(x’,y’) = T(x,y) in g(x’,y’)
• What if pixel lands “between” two
pixels?
T(x,y
y y’
)
x x’
f(x,y g(x’,y’
) )
Forward Warping
• Send each pixel (x,y) to its corresponding location
(x’,y’) = T(x,y) in g(x’,y’)
• What if pixel lands “between” two
• pixels?
Answer: add “contribution” to several
pixels, normalize later (splatting)
• Can still result in holes
T(x,y
y y’
)
x x’
f(x,y g(x’,y’
) )
Inverse Warping
• Get each pixel g(x’,y’) from its corresponding
location (x,y) = T-1(x,y) in f(x,y)
• Requires taking the inverse of the
transform
• What if pixel comes from “between” two
pixels?
T-
y y’
1
(x,y)
x x’
f(x,y g(x’,y’
) )
Inverse Warping
• Get each pixel g(x’,y’) from its corresponding
location (x,y) = T-1(x’,y’) in f(x,y)
• What if pixel comes from “between” two
• Answer:
pixels? resample color value from
interpolated (prefiltered) source image
T-
y y’
1
(x,y)
x x’
f(x,y g(x’,y’
) )
Interpolation
• Possible interpolation filters:
– nearest neighbor
– bilinear
– bicubic
– sinc
• Needed to prevent “jaggies”
and “texture crawl”
(with prefiltering)
Questions?