geometric transformations, 8dof transform · classes of image transformations • rigid...

23
Geometric Transformations, 8DOF Transform Lecture #5 Friday January 26, 2018

Upload: duongkhanh

Post on 28-Aug-2018

242 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Geometric Transformations,8DOF Transform

Lecture #5Friday January 26, 2018

Page 2: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Classes of Image Transformations• Rigid transformations– Combine rotation and translation– Preserve relative distances and angles– 3 Degrees of freedom

• Similarity transformations– Add scaling to rotation and translation– Preserves relative angles– 4 Degrees of freedom

Page 3: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Affine Transformations• Any transform of the form:!"1=

% & '( ) *0 0 1

,-1

• 6 DOF• Arbitrary combination of– translations– rotations– scales (uniform or non-uniform)– shears

Page 4: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Similarity vs. Affine Matrices• Similarity : 4 DOF

• Affine : 6 DOF

!!!

"

#

$$$

%

&

!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

11001yx

fedcba

vu

uv1

!

"

###

$

%

&&&=

a b c−b a d0 0 1

!

"

###

$

%

&&&

xy1

!

"

###

$

%

&&&

Page 5: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Specifying Affine Transformations

• There are six unknowns in the matrix (a through f)• If you specify one point in the source image and a

corresponding point in the target image, that yields two equations:

• So providing three point-to-point correspondences specifies an affine matrix

feydxvcbyaxu

iii

iii

++=

++=

Page 6: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Perspective Transformations

• We can go beyond affine transformations.• We can do any perspective transformation of a

one 3D view of a plane to another view.• Therefore, we can model an image as a plane

in space, and project it onto any other image.– How does this differ from the perspective

projection pipeline in CS410?

Page 7: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Perspective Matrix

• Why does element [3,3] = 1?• How many points are needed to specify this matrix?

u'v 'w

"

#

$ $ $

%

&

' ' '

=

a b cd e fg h 1

"

#

$ $ $

%

&

' ' '

xy1

"

#

$ $ $

%

&

' ' '

u = u'w , v = v'

w

Page 8: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Solving for Perspective

• Four corresponding points produce eight equations, eight unknowns --- but we can�t observe w

1'

1'

++

++==

++

++==

ii

ii

i

ii

ii

ii

i

ii

hygxfeydx

wvv

hygxcbyax

wuu

Page 9: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Solving (cont.)

• Multiply to get rid of the fraction…

• Now, remember that the u’s, v’s, x’s & y’s are known; group the unknown terms

( )( ) feydxhygxv

cbyaxhygxu

iiiii

iiiii

++=++

++=++

11

iiiiiii

iiiiiii

vhyvgxfeydxvuhyugxcbyaxu

−−++=

−−++=

Page 10: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Solving (III)

• And express the result as a system of linear equations

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

−−

−−

−−

−−

−−

−−

−−

−−

=

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

hgfedcba

vyvxyxuyuxyxvyvxyxuyuxyxvyvxyxuyuxyxvyvxyxuyuxyx

vuvuvuvu

444444

444444

333333

333333

222222

222222

111111

111111

4

4

3

3

2

2

1

1

10000001100000011000000110000001

Page 11: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Solving (IV)

• Finally, invert the constant matrix and solve

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

=

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

−−

−−

−−

−−

−−

−−

−−

−−−

hgfedcba

vuvuvuvu

vyvxyxuyuxyxvyvxyxuyuxyxvyvxyxuyuxyxvyvxyxuyuxyx

4

4

3

3

2

2

1

11

444444

444444

333333

333333

222222

222222

111111

111111

10000001100000011000000110000001

Page 12: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Solving (V) : Questions

• Is there always a solution?• Under what conditions is the matrix invertible?• Is the solution always unique?

Page 13: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Perspective Image Transforms (Intuition)• What does the following matrix do?

!!!

"

#

$$$

%

& −

100022022

Page 14: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Matrix Decomposition

• Note that such decompositions are:– not unique (why?)– difficult to intuit

!!!!!!

"

#

$$$$$$

%

& −

!!!

"

#

$$$

%

&

=!!!

"

#

$$$

%

& −

100

021

21

021

21

100020002

100022022

original Scale by 2 Rotation

by 45

Page 15: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

More Intuitions

• What will the following matrix do?

• More specifically, what will it do to the giraffe image?

1 0 00 1 01 −1 1

"

#

$$$

%

&

'''

Page 16: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Check Your Intuitions

• What�s going on here?

Page 17: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

More Intuition Checking

• Part of what you are seeing is a scale effect– positive terms in the bottom row create larger w values, and

therefore smaller u, v values

• Something much weirder is also going on:– What happens when y = x+1?– How do you interpret this geometrically?– Isn’t the perspective transform linear?

• So how do you select transformation matrices?

Page 18: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Perspective Transform of 2D Planes Continued.

• Recall the basic equation for the perspective transform

• The only practical way to specify an image transform is by providing four point correspondences

u'v 'w

"

#

$ $ $

%

&

' ' '

=

a b cd e fg h 1

"

#

$ $ $

%

&

' ' '

xy1

"

#

$ $ $

%

&

' ' '

u = u'w , v = v'

w

Page 19: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Computing Transformations

• Remember how to build a transformation from four point correspondences….

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

−−

−−

−−

−−

−−

−−

−−

−−

=

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

hgfedcba

vyvxyxuyuxyxvyvxyxuyuxyxvyvxyxuyuxyxvyvxyxuyuxyx

vuvuvuvu

444444

444444

333333

333333

222222

222222

111111

111111

4

4

3

3

2

2

1

1

10000001100000011000000110000001

Page 20: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Computing...• So if we want the following mapping:

(0,0)®(0,0), (0,144)®(0,144), (152,0)®(152,50), (152,144)®(152,94)

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

−−

−−

13536142881144152000218882310400011441520760010152000023104000101522073601144000000000114400010000000000100

Page 21: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

…More Computing...

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

=

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

=

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

!!!!!!!!!!!

"

#

$$$$$$$$$$$

%

&

−−

−−

−−−

−−−−

−−−−

001497.01077.100274.3

9415250152144000

0000.0000.0000.0000.000.000.000.000.000.000.000.000.000000100007.0007.007.007.007.007.007.002.014.002.007.002.014.002.0000000100000007.0007.022.007.022.014.023.007.023.014.

hgfedcba

M-1u&v

vector

What doesThis say about x?

How doesThis alter it?

Remember the earlierWLOG? c = u1,…

Page 22: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

…yields!!!

"

#

$$$

%

&

1001497.01077.100274.3

Page 23: Geometric Transformations, 8DOF Transform · Classes of Image Transformations • Rigid transformations –Combine rotation and translation –Preserve relative distances and angles

Back to Attention…

• In PA1, you map attention windows to a target output video size– Using an affine transformation• Why affine? Why not rigid? Why not perspective?