<<

2: Vanishing points and horizons. Applications of projective transformations.

Lecture 1: Euclidean, similarity, affine and projective transformations. Homo- geneous coordinates and matrices. Coordinate frames. Perspective and its matrix representation.

Lecture 2: Vanishing points. Horizons. Applications of projective transfor- mations.

Lecture 3: Convexity of point-sets, convex hull and algorithms. Conics and , implicit and parametric forms, computation of intersections.

Lecture 4: Bezier curves, B-splines. Tensor-product surfaces.

1 Recall: Perspective (central) projection — 3D to 2D 2.1

Y

The camera model Mathematical ideal- ized camera 3D ¡ 2D X X

y Image coordinates ¢¤£

x

Camera frame ¥§¦©¨ (origin at optical x centre) O

f

¨ Focal length , image is at Z

. image

Similar triangles plane



¥ £ ¦

¢ Y



y

¨ ¨   ¨

 f where and are 3-vectors, with

 Z



¢£  ¥¦  ¨!

, . 

Vanishing Points 2.2

2 Vanishing Points in 1D and 2D 2.3

x 1D image O Vanishing point Point at

1D world

image plane

vanishing point v horizon O line vanishing point parallel lines

Ground plane

All parallel lines meet at the same vanishing point 2.4

A line of 3D points isrepresented as

-,

¨

Using the vanishing point of



 ()"+*

#"$% '& its image is

& (:"¤*

.

;=< <

/1032 #"$9 

4576+8 (:"$> λ 

λ X( ) D

@ GH

= 0 ?

<

,

@ H

@ H

>CB >

<

,

*

<

>ED >

A 

A I

F > V

O J.

depends only on the direction * , not

on & . Parallel lines have the same vanishing point.

3 The Homogeneous KMLON Projection Matrix 2.5

Y

X

X  y

 x

x  ¨ O f

F Z

Choose P from now on.

-,

Q¢SRTT¢VUWT¢¤XT ¨

Homogeneous image coordinates  correctly represent if



GH ?@

H @

GH ?@ [\ _a`

F ^ ^ ^

H @

¥

H @ \ `

H ? G @



H @ \ `

¢YR

H @

^ F ^ ^

H @

¦

A I

F

U

ced©fhgji ¢

I A Z

] b

^ ^ F ^

¨

I A

F

X ¢

because then

R U

¢ ¥ ¢ ¦

¢P £k

¢¤X ¨ ¢VX ¨

Then perspective projection is a linear map, represented by a l§mMn projection matrix, from 3D to 2D.

Vanishing points using homogeneous notation 2.6 *

A line of points in 3D through the point & with direction is



Qo & (poY* Z

Writing this in homogeneous notation

? G

@ H

@ H

@ H

R

¥ Qo

@ ? ? G ? G ? H G G

F

@ H

@ H

U

¥ Qo & & * *

A A I A I A I I

F F ^ ^

(vo (

Z Z

¥qXrQo

o

A I

¥tsuQo

?@ GH

¡ w

Atxzy I

In the limit o the point on the line is

^

So, homogeneous vectors with ¥qs{ represent points “at infinity”.

Points at infinity are equivalent to directions

4

Vanishing points using homogeneous notation: Example 2.7 w

The vanishing point of a line with direction * is the image of the point at ...

[\ _a` ?@ GH

F ^ ^ ^

\ ` @ H

? G

\ ` @ H

>CB

^ F ^ ^

*

.

A I

^

>|D

A I

] b

<

^ ^ F ^ >

Exercise: Compute the vanishing points of lines on an ¥}¨ plane:

n~€ ¨ ¥

(1) parallel to the ¨ axis; (2) at to the axix; (3) parallel to the axis.

?@ GH



@ H ?@ GH



@ H

 ‚

 ‚ A

1: I I„ƒ

1 A  y ‚

D = 0 ‚

GH @

3 0 ?

GH H ?@

x @

H Z @

 ‚ ‚

1  I

2 A I„ƒ

D 2 = 0 A 

1 ‚

‚

GH ?@

G ?

H H @

0 @ H X @ D = 0 

Y 1 

 I

1 3: A

ƒ

I A

Z  

The advantages of homogeneous notation ... 2.8

Jump you daft cat. There are two advantages of using homogeneous notation to represent perspective projection: 1. Non-linear projections equations are turned into linear equations. The tools of linear algebra can then be used. 2. Vanishing points are treated naturally, and awkward limiting procedures are then avoided.

5

Plane to Plane Projective Transformations 2.9

? G

@ H

@ H

? G

@ H

@ H

R

¥

@ H

@ H

@ H

R

¢ H

O @

@ H U

Z ¥

U

¢ ' I

Z=0 plane A

¥qX

A I X ¢¤X Y ¥ts

Choose the world coordinate system such that the world plane has zero ¨ co-

l‡mpl ordinate. Then the lm†n matrix reduces to a plane to plane projective

transformation.

?@ GH

@ H

GH [\ _a` [\ _a` ?@ GH ?@

@ H

¥

H \ ` \ ` @ H @

ˆ ˆ ˆ ˆ ˆ ˆ ˆ

@ H

H \ ` \ ` @ H @

R‰R RU RQX Rs R‹R RU Rs R

¥ ¢

@ H

@ H

¦

ˆ ˆ ˆ ˆ ˆ ˆ ˆ

^

UŠR U‹U UŒX U#s UR U‹U U#s U

¦

¢

I A I A

] b ] b

F

ˆ ˆ ˆ ˆ ˆ ˆ ˆ

A I

F

XR X‰U X‹X XŒs XŠR X‰U XŒs X ¢

This is the most general transformation between the world plane and image plane under imaging by a perspective camera.

A projective transformation is also called a “” and a “collineation”.

6

Computing a projective transformation 2.10

G ? [ _ ? G

H @ \ ` @ H

  

H @ \ ` @ H

H @ \ ` @ H

¢+Ž R‰R RU RX ¢YR

R

 

x 

¢ UŠR U‹U U‹X ¢VU

Ž

U

Z

I A A I

] b

  

¢+Ž XR X‰U X‰X ¢¤X

x X

?@ GH

@ H

@ H

O ¢YR

 ¢VU

Z A y y I x ¢¤X

x l‘m’l where  is a non-singular homo- geneous matrix with EIGHT degrees of freedom.

Each point correspondence gives two constraints

     

¢+Ž ¢+Ž R‹R‰¢©( RU£“( RQX UR”¢•( U‹UŠ£–( UŒX

R U

Ž Ž

     

¢  £

XŠR X‰U X‹X XŠR X‰U X‹X

¢ ¢©( £“( ¢ ¢•( £–(

Ž Ž

X X

and multiplying out give two equations linear in the elements of 

     

Ž

XŠR X‰U X‹X R‹R RU RQX

¢  ¢•( £–(  ¢©( £“(

     

Ž

XŠR X‰U X‹X UR U‹U UŒX

£  ¢•( £–(  ¢©( £“(

Simple Example 2.11

Q¢VŽ1£™Žš Suppose the correspondences Q¢—Š£+„˜ are known for four points (no

three collinear), then  is determined uniquely. (0,1) (1,1) (0,1) (2,1) H

(0,0) (1,0) (0,0) (1,0)

^ ^ ^ ^

¡

F ^ F ^

¡

    

First correspondence 

    

Second correspondence 

‚ ‚

?@ GH [\ _a` ?@ GH ?@ GH

   

^ ^

@ H \ ` @ H @ H ?@ GH [\ _a` ?@ GH ?@ GH

Ÿ¡ ¢ rŸ £ Ÿ ¢



@ H \ ` @ H @ H

R‹R RU RX RQX

   

^ ^

Ÿr rŸh¢ Ÿh

œu

 ‚   ‚

A IPž A IPž A I

] b

"›R UR U‹U U‹X UŒX

A I A I A I

] b Ÿr¤ rŸh¤¢Ÿr¤¢¤ Ÿh¤ ¦¥qŸr¤¢¤

   

F F

XŠR X‰U X‰X X‹X

   

^©¨¡ª+«

 

^

R‹R% XRS( X‹X

Whence UŠR§

RX UŒX

Whence .

7

Simple example Continued 2.12

   

^ F ^ F ^

¡

     RU¬ U‹U¬ X‰U­( X‹X

Third correspondence  gives and .

F F F

¡

  #® 

Fourth correspondence 

? G [ _ ? G ? G

@ H \ ` @ H @ H

   

^ ^ F

@ H \ ` @ H @ H

@ H \ ` @ H @ H

XŠR X‹X XR X‹X

® ( (

   

F ^ ^ F

s X‰U X‹X X”U X‹X

" ( (

A I A I A I

] b

     

F F

XŠR X‰U X‹X XRS( X‰U­( X‹X ¯ Take ratios ¯ 2 equations in 3 unknowns solve for ratio of matrix elements

only.

[ _ [ _

\ ` \ `

^ ^ ^ ^

\ ` \ `

\ ` \ `

® ®

^ F ^ ^ F ^

k "

Z

] b ] b

^ °EF ^ °•F

® ®

Computational Algorithm 2.13

The equations,

     

Ž

XŠR X‰U X‹X R‹R RU RQX

¢  ¢•( £–(  ¢©( £“(

     

Ž

XŠR X‰U X‹X UR U‹U UŒX

£  ¢•( £–(  ¢©( £“(

can be rearranged as

_ [

F ^ ^ ^ ° ° °

¢ £ ¢ ¢ ¢ £ ¢

Ž Ž Ž

b9± ]

^ ^ ^ F ° ° °

g

¢ £ £ ¢ £ £ £

Ž Ž Ž

        

±

 R‹RT RUW RX² URT U‰UW UŒX² XŠRT X”UW X‹X³  where  is the matrix written as a 9- vector.

8 continued ... 2.14

For 4 points,

[\ _a`

F ^ ^ ^ ° ° °

\ `

\ `

¢YR£¦R ¢ ¢YR ¢ £¦R ¢

Ž Ž Ž

R R R

\ `

^ ^ ^ F ° ° °

\ `

\ `

¢SR´£µR £¦Ž ¢YR £™Ž £¦R £™Ž

R R R

\ `

F ^ ^ ^ ° ° °

\ `

\ `

¢VU £U ¢ ¢VU ¢ £U ¢

Ž Ž Ž

U U U

\ `

^ ^ ^ F ° ° °

\ `

\ `

U U U U

¢ £ £ ¢ £ £ £

Ž Ž Ž

U U U

±

\ `

F ^ ^ ^ ° ° °

g

\ `

\ `

X X X X

¢ £ ¢ ¢ ¢ £ ¢

Ž Ž Ž

X X X

\ `

^ ^ ^ F ° ° °

\ `

\ `

X X X X

¢ £ £ ¢ £ £ £

Ž Ž Ž

X X X

F ^ ^ ^ ° ° °

s s s s

¢ £ ¢+Ž ¢ ¢+Ž £ ¢+Ž

s s s

] b

^ ^ ^ F ° ° °

¢¤s £¶s £ ¢+s £ £us £

Ž Ž Ž

s s s

± ±

g · ¸mp¹ which has the form · , with a matrix. The solution is the (one

dimensional) null space of · .

If using many points, one can use least squares. Solution best found then using

±

º»¡¼j½)¾ · ¼ SVD of · — ie Then is the column of corresponding to smallest singular value. (The smallest singular value would be zero of all the data were exact ...)

Some Matlab 2.15 npoints = 4 (or 5 later -- 5th point is noisy) x = [0,1,0,1, 1.01]; y = [0,0,1,1, 0.99]; xd = [0,1,0,2, 2.01]; yd = [0,0,1,1, 1.01]; A = zeros(2*npoints,9); for i=1:npoints, A(2*i-1,:)= [x(i),y(i),1,0,0,0, -x(i)*xd(i),-xd(i)*y(i),-xd(i)]; A(2*i, :)= [0,0,0,x(i),y(i),1, -x(i)*yd(i),-yd(i)*y(i),-yd(i)]; end; if npoints==4 h = null(A); else [U,S,V] = svd(A); h=V(:,9); end; H=[h(1),h(2),h(3);h(4),h(5),h(6);h(7),h(8),h(9);];

With the 4 exact points ... Adding the fifth noisy point ...

[\ _a` [\ _a`

^ °Á^ ^¡^À^À^ ^ ^À^¡^À^ ^ °Á^ ^À^¡^À^ °=^ ^À^À^À^

\ ` \ `

\ ` \ `

l¦®À~ ®¹¦~

^ ^À^À^À^ F ^¡^À^À^ °Á^ ^À^¡^À^ °Á^ ^¡^À^¤F ^ ^ ^À^À^¤F

Zz¿ Z Z Z¿ Z Z

k k ¹À¹¡¹À¹

] b ] b

^ ^À^À^À^ °Á^ F ^ °Á^ ^¡^ ^ °Á^ F ^

Z Z Z Z Z Z

l ® l™®À~ ~ l ~À~ lnÀn

Z Z ¿ Z¿ Z Z Zz¿

9 Example 1: Removing Perspective Distortion 2.16

Objective: Back project to world plane 

1. Find Euclidean coordinates of four points on the flat object plane Q¢›Ã#Š£¶ÃÄ .

Q¢ £ 



Ž Ž Ã

2. Measure the corresponding image coordinates of these four points à .

à Ã

 Q¢ Š£ ‡˜ Q¢ £ 

Ž Ž Ã

3. Compute from the four à .

F F

R

 

 Ő¤Æ ¢+Ž1£™ŽÇ  4. Euclidean coords of any image point are ¢£ .

The image can be warped onto the world plane using  . How?

Moving the image plane 2.17

An image is the intersection of a plane with the cone of rays between points in 3-space and the optical centre. Any two such “images” (with the same optical centre) are related by a planar projective transformation.

X x x

As the camera is rotated the points of intersection of the rays with the image

plane are related by a planar projective transformation. Image points and Ž

  correspond to the same scene point . 

10

Relationship in terms of rotations 2.18 U

For corresponding points R and in two views 1 and 2,

 

?@ GH

@ H

[\ _a` ?@ GH ?@ GH

F ^ ^ ^

@ H

¥

\ ` @ H @ H

[ _ @ H

\ ` @ H @ H

¥ ¥

@ H

^ F ^ ^

@ H

R g ¦

]=È b

F ^

R U ¦ R ¦ U

Z Z

È A I È A I

] b

^ ^ F ^ F F

g

 

A I F

Hence

R

Æ

U U R

R

È È

  The cameras could have different focal lengths — so one can do all of this while

rotationing and zooming. Then

R R

Æ Æ

R U¬ 'ÉU U É

R R

È È

 

where in the simplest case

[\ _a`

^ ^

\ `

\ `

ÊÃ

^ ^

ɦÃY hÃ

] b

^ ^ F

Example 2: Synthetic Rotations 2.19

Original image Warped: floor tile square Warped: door square The synthetic images are produced by projectively warping the original image so that four corners of an imaged rectangle map to the corners of a rectangle. Both warpings correspond to a synthetic rotation of the camera about the (fixed) camera centre.

11 Example 3: Mosaics 2.20

Eight images (out of 30) acquired by rotating a camcorder about its optical centre.

ÍÎ ÏРъÑÒ

×Ø

يÙÚ ÛÜ

ӊÓÔ

ËÌ

ÕÖ

ßà

ÝÞ

Register all the images to one reference image by projective transformations.

Keble Panoramic Mosaic 2.21

12 Example 4: Projective pointing devices: not just for artists! 2.22

Here the rotation joint of a pan-tilt camera become the projection centre, and tracking people in the ground plane produces a track on a notional frontal plane — like Durer’s marks. These frontal plane tracks are then converted in Cartesian tracks viewed from above.

Summary 2.23

We have looked at four classes of transformation (in 2D):

[\ _a` [\ _a`

\ ` \ `

á á æ²á æ²á

\ ` \ `

R‹R RâU ã‰ä R‹R RU ã‹ä

á á æ²á æ²á

U‰U ã‹å UR U‹U ã‹å

Euclidean: 3 DOF UR Similarity: 4 DOF

] b ] b

^ ^ F ^ ^ F

_a` [\ [\ _a`

  

` \ \ `

ç ç

` \ \ `

ã

R‹R RU ä R‹R RâU RQX

  

ç ç

UR U‹U ã‰å U‰U UŒX

Affine: 6 DOF Projective: 8 DOF UR

] b ] b

  

^ ^ F

XŠR X”U X‹X and their 3D counterparts.

13