370 likes | 511 Views
CS 395/495-26: Spring 2004. IBMR: Intro to P 3 3 -D Projective Geometry Jack Tumblin jet@cs.northwestern.edu. 3D Homogeneous Coordinates. Extend Projective space from 2D to 3D: P 2 : map 3 2 dimensions (Easy to imagine) From 2D ‘world space’ (x,y) make
E N D
CS 395/495-26: Spring 2004 IBMR: Intro to P3 3-D Projective Geometry Jack Tumblin jet@cs.northwestern.edu
3D Homogeneous Coordinates Extend Projective space from 2D to 3D: • P2: map 3 2 dimensions (Easy to imagine) • From 2D ‘world space’ (x,y) make • 2D homogeneous coordinates (x1,x2,x3). • 2D projective ‘image space’ (x’,y’) = (x1/x3, x2/x3) • P3: map 4 3 dimensions (Harder to imagine) • From 3D ‘world space’ (x,y,z) make • 3D homogeneous coordinates (x1,x2,x3,x4). • 3D projective ‘image space’ (x’,y’,z’) = (x1/x4, x2/x4, x3/x4)
3D Homogeneous Coordinates • Unifies points and planes • (but lines are messy) • Puts perspective projection into matrix form • No divide-by-zero, points at infinity defined… in R3, write point x as But in P3, write same point x as: where: x1 x2 x3 x4 x y z x = x1 / x4, y = x2 / x4, z = x3 / x4, x4 = anything, even zero!(but usually defaults to 1) y (x,y,z) x z
A Very Common Mistaek: • P2 homog. coords: 2D projective map (“one 2D pointone 3D ray” is correct) • P3 homog. coords. 3D projective map ( But “one 3D pointone 3D ray” is WRONG! It’s a 4D ray) (x,y) (x1, x2, x3) (x,y,z) (x1, x2, x3, x4) x2 x2 x3 y x x1 x1 (seen in some graphics books)
A Very Common Mistaek: • P2 homog. coords: 2D projective map (“one 2D pointone 3D ray” is correct) • P3 homog. coords. 3D projective map ( But “one 3D pointone 3D ray” is WRONG!) (x,y) (x1, x2, x3) (x,y,z) (x1, x2, x3, x4) x2 NO! Don’t confuse 3D ‘z’ with projective x4! x2 (x,y,z) x3 y x x1 x1 (seen in some graphics books)
3D Homogeneous Coordinates • P2 homog. coords: 2D projective map (A 2D point in P2 maps to a 3D Cartesian ‘ray’ through the origin) • P3 homog. coords. 3D projective map (A 3D point in P3 maps to a 4D Cartesian ‘ray’ through the origin) (x,y) (x1, x2, x3) (x,y,z) (x1, x2, x3, x4) x2 x2 (x,y,z) x3 x3 y x x1 x1 P3: a scale-able 3D volume of points. Each point gets a 4D ray (constant x4 shown) P2: a scale-able 2D plane of points. Each point gets a 3D ray (constant x3 shown)
3D Homogeneous Coordinates P3 = homog. coordinates = 3D projective map 3D point4D ‘ray’: --Superset of P2 transformations: --Includes translation, and projection from any point H (x,y,z) (x1, x2, x3, x4) (x1’, x2’, x3’, x4’) (x,y,z) x2 x2 x3 x3 x1 x1 (Approx. as many 2D planes of constant z)
P3: Point Plane duality Recall Plane Equations in 3D: Normal vector: (a,b,c) = n Unaffected by scale k, with Min. Distance from plane to origin: d Write in 3D homog. coordinates: Point x and Plane are duals (?Lines? wait….) ax + by + cz +d = 0 ^ kax + kby + kcz + kd= 0 ax + by + cz +d = 0 a b c d x1 x2 x3 x4 = 0 xT.= 0 T.x = 0
Points Plane Conversions • Find plane thru points P1,P2,P3? • Easy! Stack points: • Find null space (use SVD) • (Rank 2? collinear points!) • OR: use 3D cross products: = 0 PT1 PT2 PT3 1 2 3 4 p11 p12 p13 p14 p21 p22 p23 p24 p31 p32 p33 p34 = 0 (p1 - p3) (p2 - p3) • • -p3T · (p1 p2) (pg 47 in Zisserman book) Find ‘normal’ vector perpendicular to plane… =
Points Planes in P3 Plane can define a 3D coordinate system (find u,v coordinates within plane, w along plane normal) • Because is equiv. to plane’s normal vector • Find 3 vectors in P3 (null space of [0 0 0] ) • assemble them as rows of 4x3 M vector • To get 3D coords of any P3 point p:M p = x’ • Finds a 2D coords in P2plane (of ): x’ = u v w
Lines in P3: Awkward • Geometrically, Lines are: • Intersection of 2 (or more) planes, • An axis or ‘pencil’ of planes, • Linear combo of 2 points, p1+ A(p2-p1) • a 4 DOF entity in P3; a 4-vector won’t do! • Symbolically: Three forms of P3 lines: • ‘Span’ : Null Space of matrix: W • Plűcker Matrix • Plűcker Line Coordinates Skip this!
P3 Lines 1a: (Point-Point) Span W • Recall that a point xis on a plane iff • if 2 given points A, B intersectwith a ‘pencil’ of planes on a line, • Define a ‘P3 line’ as that intersection: stack AT, BTto make 2x4 matrix W: W = • If line W contains the plane , then W = 0 xT.= 0 (or T.x=0 ) B A AT BT .= 0 a1 a2 a3 a4 b1 b2 b3 b4
P3 Lines 1b: (Plane-Plane) Span W* • Recall that a point xis on a plane if • If 2 given planes P,Q intersect ata ‘pencil’ of points on a line, • Define a ‘P3 line’ as that intersection: stack PT, QTto make 2x4 matrix W*: W* = • If line W* contains the point x,thenW* x = 0 xT.= 0 (or T.x=0 ) P Q P Q T. x = 0 p1 p2 p3 p4 q1 q2 q3 q4
P3 Lines Summarized: Spans • (Point) Span W • (Found from points A,B) • Used to test plane : • (Plane) Span W* • (Found from planes P,Q) • Used to test point x: B W = 0 A Useful property: WT W* = W* WT = 02x2 (the 2x2 null matrix) P Q W* x = 0
P3 Lines 1: ‘Join’ reverses Spans... • Join Line W and Point p Plane W = 0 iff plane holds line W, andpT = 0 iff plane holds point p; stack … Let M = ; solve for in M = 0 • Join Line W* and Plane Point p W* p = 0 iff point p is on line W* Tp = 0 iff point p is on plane ; stack… Let M* = ; solve for p in M* p = 0 W pT W* T
Projective Transformations • Use H for transforms in P3: • Has 15 DOF (4x4 -1) • Superset of the P2H matrix: Question: ? How could a 3D cube become a 2D image of a cube in P3? h11 h12 h13 h14 h21 h22 h23 h24 h31 h32 h33 h34h41 h42 h43 h44 H = h11 h12 0 h13 h21 h22 0 h23 0 0 0 0h31 h32 0 h33 h11 h12 h13 h21 h22 h21 h31 h32 h33 HP2 =
P3 Transformations • Transform a point p or plane with H: • Transform point span W or plane span W*: • (Optional): Transform a Plűcker Matrix: p’ = H.p’ = H-T. W’ = H.W W*’ = H-T.W* L’ = H.L.HT L*’ = H-T.L*.H-1
P3’s Familiar Weirdnesses • The plane at infinity: = (0 0 0 1)T (this is the 2D set of all…) • ‘Ideal Points’ at infinity: d =p =(x1 x2 x3 0)T • (Also called ‘direction’ d in Zisserman book) • Parallel Planes intersect at a line within • Parallel Lines intersect at a point within • Any plane intersects at line l (put in P2) l x2 d as x40, points (x1,x2,x3,x4) infinity 1/x4 x3 x1
P3’s Familiar Weirdnesses • The plane at infinity: = (0 0 0 1)T • Only Hp ignores (stays for HSHA) • Recall ’ = H-T. • Careful!HS, and HA will move points within • Both HP and have 3DOF • use one to find the other: Find ’in image space; use in world-space to findHP • Find directions in with known angles in P3
What else can we DO in P3? View Interpolation! for non-planar objects! Find H (or its parts:HSHAHP): • By Plane Pairs (1T Q* 2 = 0)… • Find Q* by flatten/stack/null space method • Find HAHP from Q*Q*’relation (symmetric, so use SVD) Simpler: • By Point (or Plane) Correspondence • Can find full H (15DOF) in P3 with 5 pts (planes) • Just extend the P3method (see Project 2)
What else can we DO in P3? View Interpolation! for non-planar objects! Find H (or its parts:HSHAHP): • By Parallel Plane pairs (they intersect at ’) • Find ’ by flatten/stack/null space method, • Solve for Hp using HP-T = ’ • By Direction Pairs ( d1 ’ d2 = 0 )… • Find ’ from flatten/stack/null space method, • Find HA from ’ relation • (symmetric, so use SVD…)
What else can we DO in P3? Best of all: Define Cameras as 3D2D transform… Define multiple cameras… Define transforms from one camera image to another camera image…
What can we DO in P3? Questions to help you explore: • Can you do line-correspondence in P2? in P3? • How would you find angle between two lines whose intersection is NOT the origin? • Can you find H from known angles, 90º? • How can we adapt P2 ‘vanishing point’ methods to P3? • Given full 3D world-space positions for pixels(‘image+depth), what H matrix would you use to ‘move the camera to a new position’? • What happens to the image when you change the projective transformations H (bottom row)?
Optional: Describe P3 lines by --Plucker Matrices --Plucker Coords. Quadrics; angles and infinity
P3 Lines 2: Plűcker Matrices Line == A 4x4 symmetric matrix, rank 2, 4DOF • Line L through known points A, B: L = A.BT - B.AT = • LineL*through known planesP,Q: L* = P.QT – QPT Two forms: B A a1a2a3a4 b1b2b3b4 - b1 b2 b3 b4 a1 a2 a3 a4 P Q
P3 Lines 2: Plűcker Matrices Line == A 4x4 symmetric matrix, rank 2, 4DOF • Line L through A, B pts: L = A.BT - B.AT • LineL*through P,Q planes: L* = P.QT - QPT • L L* convert?Note that: • Skew-symmetric; • L’s has 6 params: or • Note det|L|=0 is written l12l34+ l13l42 +l14l23= 0 • Simple! Replace lijwithlmn so that {i,j,m,n} = {1,2,3,4}Examples: l12 l34,or l42l13 etc. l12l13l14l23l24l34 l12l13l14l23l34l42 (to avoid minus signs)
P3 Lines 2: Plűcker Matrices • Join Line L* and Point p Plane L*.p =(if point is on the line, then L*.p = 0) Join Line L and Plane Point p L. =p (if line is in the plane, then L. =0)
P3 Lines 3: Plűcker Line Coords ==Plűcker Matrix has 6 vital elements: • Off-diagonals or • Just make them a 6-vector: and require that det|L| = 0, or: l12l13l14l23l24l34 l12l13l14l23l34l42 (to avoid minus signs) l12l13l14l23l42l34 L = l12l34+ l13l42 +l14l23= 0
Quadrics Summary Quadrics are the ‘x2 family’ in P3: • Point Quadric: xT Q x = 0 • Plane Quadric: T Q* = 0 • Transformed Quadrics: • Point Quadric: Q’ = H-TQ H • Plane Quadric: Q*’ = HQ* HT • Symmetric Q, Q* matrices: • 10 parameters but 9 DOF; 9 points or planes • (or less if degenerate…) • 4x4 symmetric, so SVD(Q) = USUT Ellipsoid: 1 of 8 quadric types
Quadrics Summary • SVD(Q) =USUT: • U columns are quadric’s axes • S diagonal elements: scale • On U axes, write any quadric as:au12 + bu22 +cu32 + d = 0 • Classify quadrics by • sign of a,b,c,d: (>0, 0, <0) • Book’s method: • scale a,b,c,d to (+1, 0, –1) • classify by Q’s rank and (a+b+c+d) Ellipsoid: 1 of 8 quadric types
Quadrics Summary AllUnruled Quadrics are Rank 4: (See page 55) BUT Some Rank 4 Jack!check this!!! quadrics areRuled: and All degenerate quadrics (Rank<4) are Ruled (or Conic)
New Weirdness: Absolute Conic • WHY learn ? Similar to C for P2… • Angles from directions (d1, d2) or planes (1, 2) • has 3DOF for HP; has 5DOF for HA • Requires TWO equations: : • is complex 2D Point Conic on the plane (?!?!?!) • Recall plane at infinity = [ 0, 0, 0, 1]T holds ‘directions’ d = [x1, x2, x3, 0]T x12 + x22 + x32 = 0, or ‘2D point conic where C = I’ x4 = 0, or ‘all points are on ’ .
New Weirdness: Absolute Conic • is complex 2D Point Conic on the plane • Only HAHP transforms (stays for HS) • All circles (in any ) intersect circular pts. • (recall: circular pts. hold 2 axes: x iy) • All spheres (in P3) intersect at all pts. (not clear what this reveals to us) x12 + x22 + x32 = 0, or ‘2D point conic where C = I’ x4 = 0, or ‘all points are on ’ .
New Weirdness: Absolute Conic measures angles between Directions (d1,d2) • World-space isI3x3 (ident. matrix) within • Image-space ’ is transformed (How? as part of ?) • Euclidean world-space angle is given by: • Directions d1,d2 are orthogonal iff d1T’ d2 = 0 • ?!?! What is in P3? Perhaps ? but…. • JACK!!!CHECK THIS!! (d1T’ d2). (d1T’ d1) (d2T’ d2) cos() = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 (do not change)
Absolute Dual Quadric Q* Exact Dual to Absolute Conic in plane • Any conic in a plane = a degenerate quadric • (even though plane consists of all points at infinity) • (even though conic has no real points, all ‘outer limits’ of ) Q* is a Plane Quadric that matches • Defined by tangent planes (e.g. TQ*=0) • Conic is on the ‘rim’ of quadric Q* • In world space, Q* = • Image space: 8DOF (?same as ?) (up to similarity) 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
Absolute Dual Quadric Q* 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 • In world space, Q* == • Q* always has infinity plane as tangentQ* = 0 and Q*’’= 0 • Find angles between planes 1,2 with Q*: . • Can test for planes 1,2 : 1TQ*’ 2 = 0 0 0 0 1 (1TQ*’ 2) . (1TQ*1) (2TQ*2) cos() = End of Chapter 2. Now what?
Absolute Dual Quadric Q* How can we find Q*’ ? • From plane pairs (flatten, stack, null space…) How can we use it? • Transforms: “Q*fixed iff H is a similarity” meansChanges Q* to Q*’unless H is only Hp(Recall thatQ*’ =H Q* HT ) • THUS known Q*’ can solve for HAHP • Q*’ is symmetric, use SVD...