Transformations
Reading • Szeliski: Chapter 3.6
Copyright By PowCoder代写 加微信 powcoder
What is the geometric relationship between these two images?
Answer: Similarity transformation (translation, rotation, uniform scale)
Image Warping
• image filtering: change range of image
• g(x) = h(f(x)) fg
xx • image warping: change domain of image
• g(x) = f(h(x)) fg
Image Stitching 4
Image Warping
• image filtering: change range of image
• g(x) = h(f(x)) fg
• image warping: change domain of image
• g(x) = f(h(x)) g
Image Stitching
Image Warping
• Given a coordinate xform (x’,y’) = T(x,y) and a source image f(x,y), how do we compute an xformed image?
y T(x,y) y’ x f(x,y)
x’ g(x’,y’)
Forward Warping
• Send each pixel f(x,y) to its corresponding
location (x’,y’) = T(x,y) in g(x’,y’)
y T(x,y) y’ x f(x,y)
x’ 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
y T-1(x’,y’) y’ x f(x,y)
x’ g(x’,y’)
Parametric (global) warping
p = (x,y) p’ = (x’,y’)
• Transformation T is a coordinate-changing machine:
• What does it mean that T is global?
– Is the same for any point p
– can be described by just a few numbers (parameters)
• Let’s consider linear xforms (can be represented by a 2D matrix):
Common linear transformations • Rotation by angle θ (about the origin)
(0,0) (0,0)
2×2 Matrices
• What types of transformations can be represented with a 2×2 matrix?
2D mirror about Y axis?
2D mirror across line y = x?
2×2 Matrices
• What types of transformations can be represented with a 2×2 matrix?
2D Translation?
All 2D Linear Transformations
• Linear transformations are combinations of …
– Rotation, – Shear, and – Mirror
x’ = a be y’ c dg
bx d y
How can we represent translation as a 3×3 matrix?
x’= x+tx y’= y+ty
y ‘ f i
c jx
Homogeneous coordinates
Trick: add one more coordinate:
homogeneous image coordinates
homogeneous plane
(x/w, y/w, 1)
y Converting from homogeneous coordinates
• Which one is true about the homogeneous coordinate?
– The points (2,3,1) and (2,3,2) refer to the same point in image coordinate
– Homogeneous coordinate could represent translation
– The third dimension of the homogeneous coordinate must be greater or equal to 1
Translation
• Solution: homogeneous coordinates to the rescue
Affine transformations
any transformation with last row [ 0 0 1 ] we call an affine transformation
Affine Transformations
• Affine transformations are combinations of …
– Linear transformations, and – Translations
x’ 1 0 tx x y’ = 0 1 ty y
1 0 0 11
x’ cos −sin 0x y’ = sin cos 0y
10 0 11
x’ a b cx y’=d e fy
w 0 0 1w
x’ sx 0 0x y’ = 0 sy 0y 1 0 0 11
x’ 1 shx 0x y’ = shy 1 0y
1 0 0 11
2D in-plane rotation
Where do we go from here?
what happens when we mess with this row?
affine transformation
Projective Transformations aka Homographies
Called a homography
Homographies
Image Warping
• Given a coordinate xform (x’,y’) = T(x,y) and a source image f(x,y), how do we compute an xformed image?
y T(x,y) y’ x f(x,y)
x’ g(x’,y’)
Forward Warping
• Send each pixel f(x,y) to its corresponding
location (x’,y’) = T(x,y) in g(x’,y’)
• What if pixel lands “between” two pixels?
y T(x,y) y’ x f(x,y)
x’ g(x’,y’)
Forward Warping
• Send each pixel f(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
• Can still result in holes
y T(x,y) y’
x’ 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?
y T-1(x’,y’) y’ x f(x,y)
x’ g(x’,y’)
Inverse Warping
• Get each pixel in g from its corresponding
location in f
• What if pixel comes from “between” two pixels?
• Answer: resample color value from interpolated (prefiltered) source image
y T-1(x’,y’) y’ x f(x,y)
x’ g(x’,y’)
Interpolation
• Possible interpolation filters: – nearest neighbor
– bilinear
– bicubic (interpolating) –…
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com