38
Lecture 15: Fundamental Matrix CSE 152: Computer Vision Hao Su

Lecture 15: Fundamental Matrix - GitHub Pages · 2020. 12. 10. · Essential Matrix • Let camera 1 be [I, 0] and camera 2 be [R, t].• In camera 1 coordinates, 3D point X is given

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

  • Lecture 15: Fundamental Matrix

    CSE 152: Computer VisionHao Su

  • Agenda• Review: Epipolar Geometry • Fundamental matrix • Estimating F

  • Epipolar Geometry

    O1 O2

    e1 e2

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    q

    X

    p

    e1

    l1 l2

    e2

    O1 O2

    • Epipolar plane

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    q

    X

    p

    e1

    l1 l2

    e2

    O1 O2

    • Epipolar plane

    a pixel corresponds to a ray

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    q

    X

    p

    e1

    l1 l2

    e2

    O1 O2

    • Epipolar plane

    a pixel corresponds to a ray

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    X

    p

    e1

    l1

    e2

    O1 O2

    • Epipolar plane

    m1

    a pixel corresponds to a raya ray corresponds to a line

    in the other view

    q

    l2

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    X

    p

    e1

    l1

    e2

    O1 O2

    • Epipolar plane

    m1

    a pixel corresponds to a raya ray corresponds to a line

    in the other view

    q

    l2

    so, a pixel corresponds to a line in the other view

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    X

    p

    e1

    l1

    e2

    O1 O2

    • Epipolar plane

    m1 m2

    • Epipolar line

    q

    l2

    so, a pixel corresponds to a line in the other view

    so, a pixel corresponds to a line in the other view

  • Epipolar Geometry

    • Epipoles: e1 , e2= intersections of baseline with image planes= projections of the other camera center

    • Epipoles: e1 , e2• Baselines

    X

    p

    e1

    l1

    e2

    O1 O2

    • Epipolar plane

    m1 m2

    • Epipolar line

    q

    l2

    All of the epipolar lines in an image pass through the epipole.

  • Agenda• Review: Epipolar Geometry • Essential Matrix • Fundamental matrix • Estimating F

  • Cross Product as Matrix Multiplication

    [𝑎×] = − [𝑎×]𝑇

    “skew-symmetric matrix”rank 2

  • Essential Matrix

    • Let camera 1 be [I, 0] and camera 2 be [R, t]. • In camera 1 coordinates, 3D point X is given by . • In camera 2 coordinates, 3D point X is given by . • Since camera 2 is related to camera 1 by rigid-body motion [R, t]

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    • Assume and in are two points on the (virtual) image plane of two cameras

    • Denoted by the pinhole frame coordinate in the corresponding cameras

    p q ℝ3

  • Essential Matrix

    • Assume cameras with K1 = K2 = I3x3. • Let camera 1 be [I, 0] and camera 2 be [R, t]. • In camera 1 pinhole frame, 3D point X is given by . • In camera 2 coordinates, 3D point X is given by . • Since camera 2 is related to camera 1 by rigid-body motion [R, t]

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

  • Essential Matrix

    • Assume cameras with K1 = K2 = I3x3. • Let camera 1 be [I, 0] and camera 2 be [R, t]. • In camera 1 pinhole frame, 3D point X is given by . • In camera 2 pinhole frame, 3D point X is given by . • Since camera 2 is related to camera 1 by rigid-body motion [R, t]

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

  • • Assume cameras with K1 = K2 = I3x3. • Let camera 1 be [I, 0] and camera 2 be [R, t]. • In camera 1 pinhole frame, 3D point X is given by . • In camera 2 pinhole frame, 3D point X is given by . • Assume [R, t] changes the coordinate in camera 2 to the coordinate in

    camera 1

    Essential Matrix

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    (change of coordinate system)X1 = RX2 + tλ1p1 = λ2Rq2 + t

    X1 = λ1p1X2 = λ2q2

  • Essential Matrix

    • We have: • Take cross-product with respect to t:

    • Take dot-product with respect to q:

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    λ1p1 = λ2Rq2 + t

  • Essential Matrix

    • We have: • Take cross-product with respect to t:

    • Take dot-product with respect to q:

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    λ1p1 = λ2Rq2 + t

    λ1[t]×p1 = λ2[t]×(Rq2 + t)

  • Essential Matrix

    • We have: • Take cross-product with respect to t:

    • Take dot-product with respect to q:

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    λ1p1 = λ2Rq2 + t

    λ1[t]×p1 = λ2[t]×(Rq2 + t)

  • Essential Matrix

    • We have: • Take cross-product with respect to t:

    • Take dot-product with respect to :p1

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    0 = λ2(p1)T[t]×Rq2

    λ1p1 = λ2Rq2 + t

    λ1[t]×p1 = λ2[t]×(Rq2 + t)

  • • We have:

    • Define:

    • Then, we have:

    Essential Matrix

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    Essential matrix

    X

    (p1)T[t]×Rq2 = 0

    rank(E)=2

    (p1)TEq2 = 0 pTEq = 0omit superscript

  • Agenda• Review: Epipolar Geometry • Essential Matrix • Fundamental matrix • Estimating F

  • • Consider intrinsic camera matrices • Then, p and q are in the pinhole frame and pixel counterparts are:

    • Recall essential matrix constraint:

    • Substituting, we have:

    Fundamental Matrix

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    X

    pTEq = 0

    (K−11 p′ )TE(K−12 q′ ) = 0

  • • Essential matrix constraint in pixel space: .

    • Rearranging:

    • Define:

    • Then, we have:

    Fundamental Matrix

    epipolar plane

    epipolar lineepipolar line

    0

    (projection of ray)

    Fundamental matrix

    X

    (K−11 p′ )TE(K−12 q′ ) = 0

    p′ TK−T1 EK−12 q′ = 0

    p′ TFq′ = 0

    F = K−T1 EK−12 rank(F)=2

  • Fundamental Matrixp′ TFq′ = 0

    [xp, yp, zp]F11 F12 F13F21 F22 F23F31 F32 F33

    xqyqzq

    = 0

    [xp/zp, yp/zp,1]F11 F12 F13F21 F22 F23F31 F32 F33

    xq/zqyq/zq

    1

    = 0

    ⋅ /zp ⋅ /zq

    pixel coordinates

    X

  • Epipolar Constraint

    pT ⋅ E p' = 0𝑝𝑇1 ⋅ 𝐹𝑝2 = 0• defines an equation

    • Note that, is the corresponding point of by the derivation of F

    • So, defines the epipolar line of

    w1 = Fp2 wT1 p1 = 0p1 p2

    w1 = Fp2 p2

  • • w1 = F p2 defines an equation , the epipolar line m1 of p2

    • w2 = FTp1 defines an equation , the epipolar line m2 of p1

    • F is singular (rank two) • F e2 = 0 and FT e1 = 0

    wT1 p1 = 0

    wT2 p2 = 0

    Epipolar Constraint

    O1 O2

    p2

    P

    e1 e2m1 m2

    pT ⋅ E p' = 0 [Eq. 10]

    p1

    𝑝𝑇1 ⋅ 𝐹𝑝2 = 0

  • Why F is useful?

    - Suppose F is known - No additional information about the scene and camera is given - Given a point on left image, we can compute the corresponding epipolar line in the second image

    m2 = FT p1p1 p2

  • Why F is useful?

    • F captures information about the epipolar geometry of 2 views + camera parameters

    • MORE IMPORTANTLY: F gives constraints on how the scene changes under view point transformation (without reconstructing the scene!)

    • Powerful tool in: • 3D reconstruction • Multi-view object/scene matching

  • Agenda• Review: Epipolar Geometry • Essential Matrix • Fundamental matrix • Estimating F

  • Estimating F Suppose we have a pair of corresponding points:

  • Estimating F

  • Estimating F

  • Estimating F

  • rank(F)=2

  • Problems with the 8-Point Algorithm

    Wf = 0, ∥f∥ = 1

    Least-square

    minimizef

    ∥Wf∥2

    s . t . ∥f∥ = 1

    minimizef

    fTWTWf

    s . t . fT f = 1

    Do you remember how to solve the problem?

    Hint: Check your HW1 (by the SVD of W)

  • Mean errors: 10.0pixel 9.1pixel