2D Image Transforms 16-385 Computer Vision (Kris Kitani) Carnegie - - PowerPoint PPT Presentation

2d image transforms
SMART_READER_LITE
LIVE PREVIEW

2D Image Transforms 16-385 Computer Vision (Kris Kitani) Carnegie - - PowerPoint PPT Presentation

2D Image Transforms 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University Extract features from an image what do we do next? Feature matching (object recognition, 3D reconstruction, augmented reality, image stitching) How do you


slide-1
SLIDE 1

2D Image Transforms

16-385 Computer Vision (Kris Kitani)

Carnegie Mellon University

slide-2
SLIDE 2
slide-3
SLIDE 3

Extract features from an image … what do we do next?

slide-4
SLIDE 4

Feature matching

(object recognition, 3D reconstruction, augmented reality, image stitching)

How do you compute the transformation?

slide-5
SLIDE 5

{xi, x0

i} Given a set of matched feature points

x0 = f(x; p)

and a transformation Find the best estimate of

p

parameters transformation function point in

  • ne image

point in the

  • ther image

← set of point correspondences

slide-6
SLIDE 6

x0 = f(x; p)

What kind of transformation functions are there?

slide-7
SLIDE 7

2D Transformations

slide-8
SLIDE 8

translation rotation aspect affine perspective cylindrical

slide-9
SLIDE 9

2D Planar Transformations

slide-10
SLIDE 10

2D Planar Transformations

  • Each component multiplied by a scalar
  • Uniform scaling - same scalar for each component

Scale

slide-11
SLIDE 11

2D Planar Transformations

  • Each component multiplied by a scalar
  • Uniform scaling - same scalar for each component

Scale

x0 = ax y0 = by

Scale

slide-12
SLIDE 12

2D Planar Transformations

  • Each component multiplied by a scalar
  • Uniform scaling - same scalar for each component

Scale

scaling matrix S

 x0 y0

  • =

 a b  x y

  • Scale
slide-13
SLIDE 13

2D Planar Transformations Scaling Shear

slide-14
SLIDE 14

2D Planar Transformations Scaling Shear

x0 = x + a · y y0 = b · x + y

Shear

slide-15
SLIDE 15

2D Planar Transformations Scaling Shear  x0 y0

  • =

 1 a b 1  x y

  • Shear
slide-16
SLIDE 16

2D Planar Transformations x =  x y

slide-17
SLIDE 17

2D Planar Transformations x =  x y

  • x0 =

 x0 y0

  • θ
slide-18
SLIDE 18

2D Planar Transformations x =  x y

  • x0 =

 x0 y0

  • θ

x0 = x cos θ − y sin θ y0 = x sin θ + y cos θ Rotation

slide-19
SLIDE 19

Polar coordinates… x = r cos (φ) y = r sin (φ) x’ = r cos (φ + θ) y’ = r sin (φ + θ) Trig Identity… x’ = r cos(φ) cos(θ) – r sin(φ) sin(θ) y’ = r sin(φ) cos(θ) + r cos(φ) sin(θ) Substitute… x’ = x cos(θ) - y sin(θ) y’ = x sin(θ) + y cos(θ)

θ

(x, y) (x’, y’)

φ

slide-20
SLIDE 20

2D Planar Transformations x =  x y

  • x0 =

 x0 y0

  • θ

Rotation  x0 y0

  • =

 cos θ − sin θ sin θ cos θ  x y

slide-21
SLIDE 21

x0 = f(x; p)

 x0 y0

  • = M

 x y

  • 2D linear transformation 


(can be written in matrix form)

p

x

parameters point

slide-22
SLIDE 22

M =  sx sy

  • M =

 cos θ − sin θ sin θ cos θ

  • M =

 1 sx sy 1

  • M =

 −1 1

  • Scale

Rotate Shear Flip across y Flip across origin M =  −1 −1

  • M =

 1 1

  • Identity
slide-23
SLIDE 23

How do you represent translation with a 2 x 2 matrix?

x0 = x + tx y0 = y + tx

M =  ? ? ? ?

  • y
slide-24
SLIDE 24

How do you represent translation with a 2 x 2 matrix?

x0 = x + tx y0 = y + tx

not possible

slide-25
SLIDE 25

Q: How can we represent translation in matrix form?

25

x0 = x + tx y0 = y + ty

slide-26
SLIDE 26

Homogeneous Coordinates

slide-27
SLIDE 27

 x y

  • =

⇒ 2 4 x y 1 3 5

Represent 2D point with a 3D vector

add a one here

homogenous coordinates inhomogenous coordinates

slide-28
SLIDE 28

Q: How can we represent translation in matrix form?

x0 = x + tx y0 = y + ty

M =   1 tx 1 ty 1    x y

2 4 x y 1 3 5

A: append 3rd element and append 3rd column & row

slide-29
SLIDE 29

Homogeneous Coordinates

tx = 2 ty = 1

slide-30
SLIDE 30

A 2D point in an image can be represented as a 3D vector X =   x1 x2 x3   x =  x y

  • x = x1

x3 y = x2 x3

where

⇐ ⇒

Why?

slide-31
SLIDE 31

Think of a point on the image plane in 3D

X

x y z z = 1

image plane

P

X is a projection of a point P on the image plane You can think of a conversion to homogenous coordinates as a conversion of a point to a ray

slide-32
SLIDE 32

Conversion:

  • 2D point → homogeneous point


append 1 as 3rd coordinate


  • homogeneous point → 2D point


divide by 3rd coordinate

Special Properties

  • Scale invariant
  • Point at infinity
  • Undefined

 x y

2 4 x y 1 3 5 2 4 x y w 3 5 ⇒  x/w y/w

  • ⇥ x

y 0 ⇤ ⇥ x y w ⇤> = λ ⇥ x y w ⇤> ⇥ 0 0 ⇤

slide-33
SLIDE 33

Basic 2D transformations as 3x3 matrices

Translate Rotate Shear Scale

slide-34
SLIDE 34

Matrix Composition

Transformations can be combined by matrix multiplication

p’ = T(tx,ty) R(Θ) S(sx,sy) p

Does the order of multiplication matter?

slide-35
SLIDE 35

2D transformations

slide-36
SLIDE 36
slide-37
SLIDE 37

Affine Transformation

Affine transformations are combinations of

  • Linear transformations, and
  • Translations

Properties of affine transformations:

  • Origin does not necessarily map to origin
  • Lines map to lines
  • Parallel lines remain parallel
  • Ratios are preserved
  • Closed under composition (affine times affine is affine)

Will the last coordinate w ever change?

slide-38
SLIDE 38

Projective Transform

Projective transformations are combos of

  • Affine transformations, and
  • Projective warps

Properties of projective transformations:

  • Origin does not necessarily map to origin
  • Lines map to lines
  • Parallel lines do not necessarily remain parallel
  • Ratios are not preserved
  • Closed under composition
  • Models change of basis
  • Projective matrix is defined up to a scale (8 DOF)

Coming soon…