cs 395/495-26: spring 2003 ibmr: week 5 a back to chapter 2: 3 -d projective geometry jack tumblin...

23
CS 395/495-26: Spring CS 395/495-26: Spring 2003 2003 IBMR: Week 5 A IBMR: Week 5 A Back to Chapter 2: Back to Chapter 2: 3 3 -D Projective Geometry -D Projective Geometry Jack Tumblin Jack Tumblin [email protected] [email protected]

Post on 15-Jan-2016

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

CS 395/495-26: Spring 2003CS 395/495-26: Spring 2003

IBMR: Week 5 A IBMR: Week 5 A

Back to Chapter 2:Back to Chapter 2:

33-D Projective Geometry-D Projective Geometry

Jack TumblinJack [email protected]@cs.northwestern.edu

Page 2: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

IBMR-Related SeminarsIBMR-Related Seminars

3D Scanning for Cultural Heritage Applications3D Scanning for Cultural Heritage Applications Holly Rushmeier, IBM TJ Watson Holly Rushmeier, IBM TJ Watson

Friday May 16 3:00pm, Rm 381, CS Dept. Friday May 16 3:00pm, Rm 381, CS Dept.

no title yet ...<BRDF, BRSSDF capture? no title yet ...<BRDF, BRSSDF capture? Optics of Hair? Inverse Rendering?>Optics of Hair? Inverse Rendering?>

Steve Marschner, Cornell University Steve Marschner, Cornell University Friday May 23 3:00pm, Rm 381, CS Dept.Friday May 23 3:00pm, Rm 381, CS Dept.

Page 3: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

3D Homogeneous Coordinates3D Homogeneous Coordinates

Extend Projective space from 2D to 3D:Extend Projective space from 2D to 3D:• PP22: :

– From 2D ‘world space’ From 2D ‘world space’ (x,y)(x,y) make make

– 2D homogeneous coordinates 2D homogeneous coordinates (x(x11,x,x22,x,x33))..

– 2D projective ‘image space’ 2D projective ‘image space’ (x’,y’)(x’,y’) = = (x(x11/x/x33, x, x22/x/x33))

• PP33: : – From 3D ‘world space’ From 3D ‘world space’ (x,y,z)(x,y,z) make make

– 3D homogeneous coordinates 3D homogeneous coordinates (x(x11,x,x22,x,x33,x,x44))..

– 3D projective ‘image space’ 3D projective ‘image space’ (x’,y’,z’)(x’,y’,z’) = = (x(x11/x/x44, x, x22/x/x44, x, x33/x/x44))

Page 4: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

3D Homogeneous Coordinates3D Homogeneous Coordinates

– Unifies Unifies pointspoints and and planesplanes– (but (but lineslines are messy) are messy)– Puts perspective projection into matrix formPuts perspective projection into matrix form– No divide-by-zero, points at infinity defined…No divide-by-zero, points at infinity defined…

xx

yy

But in But in PP33, write , write same point same point xx as: as:where:where:

(x,y,z)(x,y,z)

in in RR33, , write point write point xx as as

xyz

x1 x2 x3

x4 x = x1 / x4,y = x2 / x4,z = x3 / x4,x4 = anything non-zero! (but usually defaults to 1)

zz

Page 5: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

A Very Common Mistaek:A Very Common Mistaek:

• PP22 homog. coords: 2D projective map homog. coords: 2D projective map (2D point(2D point3D ray is correct)3D ray is correct)

• PP33 homog. coords. 3D projective map homog. coords. 3D projective map ( But 3D point( But 3D point3D ray’ is WRONG!)3D ray’ is WRONG!)

xx22

xx11

xx22

xx11

xx33

(x,y)(x,y) (x(x11, x, x22, x, x33)) (x,y,z)(x,y,z) (x(x11, x, x22, x, x33, x, x44))

Page 6: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

A Very Common MistaekA Very Common Mistaek

• PP22 homog. coords: 2D projective map homog. coords: 2D projective map (2D point(2D point3D ray)3D ray)

• PP33 homog. coords. 3D projective map homog. coords. 3D projective map ( 3D point( 3D point3D ray’ is WRONG!)3D ray’ is WRONG!)

xx22

xx11

xx22

xx11

xx33

(x,y,z)(x,y,z)

(x,y)(x,y) (x(x11, x, x22, x, x33)) (x,y,z)(x,y,z) (x(x11, x, x22, x, x33, x, x44))

NO! Don’t confuse 3D NO! Don’t confuse 3D ‘z’ with projective x‘z’ with projective x44!!

Page 7: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP33: Point : Point Plane Plane duality duality

Recall Plane Equations in 3D: Recall Plane Equations in 3D: Normal vector: Normal vector: (a,b,c) = n(a,b,c) = n

Unaffected by scale k, withUnaffected by scale k, with

Min. Distance from plane to origin: Min. Distance from plane to origin: dd

Write in 3D homog. coordinates:Write in 3D homog. coordinates:

Point Point xx and Plane and Plane are duals are duals (lines are not!)(lines are not!)

ax + by + cz +d = 0

kax + kby + kcz + kd= 0

= 0x1 x2 x3 x4 abc d

xxT.T. = = 00

ax + by + cz +d = 0

Page 8: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

3D Homogeneous Coordinates3D Homogeneous Coordinates

• PP22 homog. coords: 2D projective map homog. coords: 2D projective map (2D point(2D point3D ray)3D ray)

• PP33 homog. coords. 3D projective map homog. coords. 3D projective map 3D point3D point4D ‘ray’4D ‘ray’::

--an impossible-to-draw --an impossible-to-draw planeplane in in RR44 with normal x1,x2,x3 with normal x1,x2,x3--its 3D part is a ray through origin --its 3D part is a ray through origin

xx22

xx11

xx22

xx11

xx33

(x,y,z)(x,y,z)

(x,y)(x,y) (x(x11, x, x22, x, x33)) (x,y,z)(x,y,z) (x(x11, x, x22, x, x33, x, x44))

xx33

(Approx. as (Approx. as many 2D planesmany 2D planes

of constant z)of constant z)(One 2D plane(One 2D planeof constant z)of constant z)

Page 9: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

3D Homogeneous Coordinates3D Homogeneous Coordinates

PP33 homog. coords. 3D projective map homog. coords. 3D projective map 3D point3D point4D ‘ray’:4D ‘ray’:

----Superset Superset of Pof P22 transformations: transformations:

--Includes translation, projection from any point--Includes translation, projection from any point

xx22

xx11

xx33

(x,y,z)(x,y,z)

(x,y,z)(x,y,z) (x(x11, x, x22, x, x33, x, x44))

(Approx. as (Approx. as many 2D planesmany 2D planes

of constant z)of constant z)

HH (x(x11’, x’, x22’, x’, x33’, x’, x44’)’)

xx22

xx11

xx33

Page 10: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

• Find plane Find plane thru points thru points PP11,P,P22,P,P33??

– Easy! Stack points:Easy! Stack points:– Find null space (SVD) Find null space (SVD) – (Rank 2? collinear points!)(Rank 2? collinear points!)

• OROR: use 3D cross products: use 3D cross products::

PointsPoints Plane Conversions Plane Conversions

PPTT11

PPTT22

PPTT33

= = 00

pp11 11 pp12 12 pp13 13 pp1414

pp21 21 pp22 22 pp23 23 pp2424

pp31 31 pp32 32 pp33 33 pp3434

11

22

33

44

= = 00

= (p1 – p3) = (p1 – p3) (p2-p3) (p2-p3) – – x3x3••(x1 (x1 x2) x2)

(p(p1 1 - - pp33) ) ( (pp2 2 - - pp33))••••

-p-p33T T · (· (pp1 1 pp22))

= =

(scalar)(scalar)

Page 11: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

Plane Plane can define a 3D coordinate system can define a 3D coordinate system (find u,v coordinates within plane, w along plane normal)(find u,v coordinates within plane, w along plane normal)

– Because Because is equiv. to plane’s normal vector is equiv. to plane’s normal vector

– Find 3 Find 3 vectors in P3 (null space of [ vectors in P3 (null space of [0 0 00 0 0 ] )] )

– assemble them as columns of 4x3 assemble them as columns of 4x3 MM vector vector – To get 3D coords of To get 3D coords of anyany P P33 point point p:p:

M p = x’M p = x’

– Finds a 2D coords in Finds a 2D coords in PP22 plane (of plane (of ): ): x’ = x’ =

PointsPoints Planes in P Planes in P33

u u v v ww

Page 12: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

Lines in PLines in P33: : AwkwardAwkward

• Geometrically, Lines are:Geometrically, Lines are:– Intersection of 2 (or more) planes,Intersection of 2 (or more) planes,– An axis or ‘pencil’ of planes,An axis or ‘pencil’ of planes,– Linear combo of 2 points, Linear combo of 2 points, pp11+ A(p+ A(p22-p-p11))

– a a 44 DOF entity in P DOF entity in P33; a 4-vector won’t do!; a 4-vector won’t do!

• Symbolically: Three forms of PSymbolically: Three forms of P33 lines: lines:– ‘‘Span’ : Null Space of matrix WSpan’ : Null Space of matrix W– PlPlűűcker Matrixcker Matrix– PlPlűűcker Line Coordinatescker Line Coordinates

Page 13: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

• Recall that a point Recall that a point xx is on a plane is on a plane iff iff

• if 2 given points if 2 given points A, B A, B intersectintersectwith a ‘pencil’ of planes on a line,with a ‘pencil’ of planes on a line,

• Define a ‘P3 line’ as that intersection:Define a ‘P3 line’ as that intersection: stack stack AATT, B, BTT to make 2x4 matrix to make 2x4 matrix W:W:

WW = =

• If line If line WW contains the plane contains the plane , then , then W W = 0 = 0

PP3 3 Lines 1a: (Lines 1a: (Point-PointPoint-Point) Span W) Span W

aa11 a a22 a a33 a a44

bb11 b b22 b b33 b b44

AA

BBxxT.T. = = 00

TT.. = = 00A A BB

Page 14: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 1b: (Lines 1b: (Plane-PlanePlane-Plane) Span W*) Span W*

• Recall that a point Recall that a point xx is on a plane is on a plane if if

• If 2 given planes If 2 given planes P,QP,Q intersect at intersect ata ‘pencil’ of points on a line, a ‘pencil’ of points on a line,

• Define a ‘P3 line’ as that intersection:Define a ‘P3 line’ as that intersection: stack stack PPTT, Q, QTT to make 2x4 matrix to make 2x4 matrix W*:W*:

W*W* = =

• If line If line W* W* contains the point contains the point xx,, thenthen W* W* x = 0x = 0

pp11 p p22 p p33 p p44

qq11 q q22 q q33 q q44

xxT.T. = = 00 PP

QQ

xxT.T.PQ PQ = = 00

Page 15: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 1:SpansLines 1:Spans

• (Point) Span W (Point) Span W – (Found from points (Found from points A,BA,B))– Used to test plane Used to test plane ::

• (Plane) Span W*(Plane) Span W*– (Found from planes (Found from planes P,QP,Q))– Used to test point Used to test point xx: :

PP

QQ

AA

BB

WWT T W* = W* WW* = W* WT T = 0= 02x22x2 (the 2x2 null matrix) (the 2x2 null matrix)

W W = 0 = 0

W* W* x = 0x = 0

Useful property:Useful property:

Page 16: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 1: ‘Join’ reverses Spans...Lines 1: ‘Join’ reverses Spans...

• Join Line Join Line WW and Point and Point p p Plane Plane W W = 0 = 0 iff plane iff plane holds line holds line WW, and, and

ppTT = 0 = 0 iff plane iff plane holds point holds point pp; stack …; stack …

Let Let M = M = ; solve for ; solve for in in M M = 0 = 0

• Join Line Join Line W*W* and Plane and Plane Point Point pp W* W* p = 0 p = 0 iff line iff line W*W* holds point holds point pp p = 0 p = 0 iff plane iff plane holds point holds point pp; stack…; stack…

Let Let M* = M* = ; solve for ; solve for pp in in M* M* pp = 0 = 0

WW

ppTT

W*W*

Page 17: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 2: PlLines 2: Plűűcker Matricescker Matrices

Line == A 4x4 symmetric matrix, rank 2, 4DOFLine == A 4x4 symmetric matrix, rank 2, 4DOF

• Line Line LL through known points through known points A, B:A, B:

L = AL = A..BBTT - B - B..AAT T ==

• LineLine L*L* through known planesthrough known planes P,Q:P,Q:

L* = PL* = P..QQTT – QP – QPTT

aa11 a a22 a a33 a a44 bb11 b b22 b b33 b b44 aa11

aa22

aa33

aa44

bb11

bb22

bb33

bb44

--

PP

QQ

AABBTwo forms:Two forms:

Page 18: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 2: PlLines 2: Plűűcker Matricescker Matrices

Line == A 4x4 symmetric matrix, rank 2, 4DOFLine == A 4x4 symmetric matrix, rank 2, 4DOF• Line Line LL through through A, BA, B pts pts:: L = A L = A..BBTT - B - B..AAT T

• LineLine L*L* through through P,Q P,Q planesplanes: : L* = PL* = P..QQTT - QP - QPTT

• L L L* L* convert?convert?Note that: Note that: – Skew-symmetric;Skew-symmetric;– L’s has 6 params: orL’s has 6 params: or– Note Note det|L|=0det|L|=0 is written is written ll1212ll3434+ l+ l1313ll42 42 +l+l1414ll2323= 0= 0

– Simple! Simple! Replace Replace llijij withwith llmn mn so that {i,j,m,n} = {1,2,3,4}so that {i,j,m,n} = {1,2,3,4}Examples: Examples: ll12 12 ll3434,or,or l l4242ll13 13 etc.etc.

ll1212 ll1313 ll1414

ll2323 ll2424

ll3434

ll1212 ll1313 ll1414

ll2323

ll3434

ll4242

(to avoid (to avoid minus signs)minus signs)

Page 19: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 2: PlLines 2: Plűűcker Matricescker Matrices

• Join Line Join Line L*L* and Point and Point p p Plane Plane L*L*..p =p =

(if point is (if point is onon the line, then the line, then

L*L*..p = 0p = 0))

Join Line Join Line LL and Plane and Plane Point Point pp LL.. = = pp

(if line is (if line is inin the plane, then the plane, then LL.. =0=0))

Page 20: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP3 3 Lines 3: PlLines 3: Plűűcker Line Coordscker Line Coords

==Pl==Plűűcker Matrix has 6 vital elements:cker Matrix has 6 vital elements:

– Off-diagonals orOff-diagonals or

– Just make them a 6-vector:Just make them a 6-vector:

and require that and require that det|L| = 0det|L| = 0, , or:or:

ll1212 ll1313 ll1414

ll2323 ll2424

ll3434

ll1212 ll1313 ll1414

ll2323

ll3434

ll4242

(to avoid (to avoid minus signs)minus signs)

L = L =

ll1212

ll1313

ll1414

ll2323

ll4242

ll3434

ll1212ll3434+ l+ l1313ll42 42 +l+l1414ll2323= 0= 0

Page 21: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

Projective TransformationsProjective Transformations

• Use H for transforms in Use H for transforms in PP33::– Has 15 DOF (4x4 -1)Has 15 DOF (4x4 -1)

– Superset of the Superset of the PP22 HH matrix: matrix:

Homework Hint:Homework Hint:

ProjA show ProjA show PP22 objects in objects in RR33

xx11x,xx,x22y,xy,x33z; usesz; uses

hh11 11 h h1212 h h1313 hh2121 h h2222 h h2121 hh3131 h h32 32 h h3333

hh1111 h h1212 0 0 h h1313 hh2121 h h2222 0 0 h h2323 00 0 0 0 0 0 0 hh3131 h h3232 0 0 h h3333

hh1111 h h1212 h h1313 h h1414

hh2121 h h2222 h h2323 h h2424

hh3131 h h3232 h h3333 h h3434

hh4141 h h4242 h h4343 h h4444

H = H =

HH22 = =

hh1111 h h1212 h h1313 0 0 hh2121 h h2222 h h2323 00hh31 31 h h3232 h h3333 00 0 0 0 0 00 11

Page 22: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

PP33 Transformations Transformations

• Transform a point Transform a point p p or plane or plane with with HH::

• Lines 1: Transform a span:Lines 1: Transform a span:

• Lines 2: Transform a PlLines 2: Transform a Plűűcker Matrix:cker Matrix:

p’ = Hp’ = H..pp ’ = H’ = H-T-T..

W’ = HW’ = H..W W*’ = HW W*’ = H-T-T..W*W*

L’ = HL’ = H..LL..HHTT L*’ = H L*’ = H-T-T..L*L*..HH-1-1

Page 23: CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu

ENDEND