cs4501: introduction to computer vision epipolargeometry
TRANSCRIPT
CS4501: Introduction to Computer Vision
Epipolar Geometry: Essential Matrix
Various slides from previous courses by: D.A. Forsyth (Berkeley / UIUC), I. Kokkinos (Ecole Centrale / UCL). S. Lazebnik (UNC / UIUC), S. Seitz (MSR / Facebook), J. Hays (Brown / Georgia Tech), A. Berg (Stony Brook / UNC), D. Samaras (Stony Brook) . J. M. Frahm (UNC), V. Ordonez (UVA), Steve Seitz (UW).
Es#ma#ng depth with stereo
• Stereo: shape from “motion” between two views• We’ll need to consider:• Info on camera pose (“calibration”)• Image point correspondences
scene point
optical center
image plane
Potential matches for x have to lie on the corresponding line l’.
Potential matches for x’ have to lie on the corresponding line l.
Key idea: Epipolar constraint
x x’
X
x’
X
x’
X
• Epipolar Plane – plane containing baseline (1D family)
• Epipoles = intersec9ons of baseline with image planes = projec9ons of the other camera center
• Baseline – line connecting the two camera centers
Epipolar geometry: notationX
x x’
• Epipolar Lines - intersections of epipolar plane with imageplanes (always come in corresponding pairs)
Epipolar geometry: notationX
x x’
• Epipolar Plane – plane containing baseline (1D family)
• Epipoles= intersections of baseline with image planes = projections of the other camera center
• Baseline – line connecting the two camera centers
Geometry for a simple stereo system
• First, assuming parallel optical axes, known camera parameters (i.e., calibrated cameras):
Simplest Case: Parallel images
• Image planes of cameras are parallel to each other and to the baseline
• Camera centers are at same height• Focal lengths are the same• Then epipolar lines fall along the
horizontal scan lines of the images
• Assume parallel optical axes, known camera parameters (i.e., calibrated cameras). What is expression for Z?
Similar triangles (pl, P, pr) and (Ol, P, Or):
Geometry for a simple stereo system
ZT
fZxxT rl =
--+
lr xxT
fZ-
=disparity
Depth from disparity
image I(x,y) image I´(x´,y´)Disparity map D(x,y)
(x´,y´)=(x+D(x,y), y)
So if we could find the corresponding points in two images, we could estimate relative depth…
Matching cost
disparity
Left Right
scanline
Correspondence search
• Slide a window along the right scanline and compare contents of that window with the reference window in the left image
• Matching cost: SSD or normalized correlation
Basic stereo matching algorithm
• If necessary, rectify the two stereo images to transform epipolar lines into scanlines
• For each pixel x in the first image• Find corresponding epipolar scanline in the right image• Examine all pixels on the scanline and pick the best match x’• Compute disparity x–x’ and set depth(x) = B*f/(x–x’)
Failures of correspondence search
Textureless surfaces Occlusions, repetition
Non-Lambertian surfaces, specularities
Ac#ve stereo with structured light
• Project “structured” light patterns onto the object• Simplifies the correspondence problem• Allows us to use only one camera
camera
projector
L. Zhang, B. Curless, and S. M. Seitz. Rapid Shape Acquisition Using Color Structured Light and Multi-pass Dynamic Programming. 3DPVT 2002
Basic stereo matching algorithm
• If necessary, rectify the two stereo images to transform epipolar lines into scanlines
• For each pixel x in the first image• Find corresponding epipolar scanline in the right image• Examine all pixels on the scanline and pick the best match x’• Compute disparity x–x’ and set depth(x) = B*f/(x–x’)
Effect of window size
• Smaller window+ More detail• More noise
• Larger window+ Smoother disparity maps• Less detail
W = 3 W = 20
Better methods exist...
Graph cuts Ground truth
For the latest and greatest: h3p://www.middlebury.edu/stereo/
Y. Boykov, O. Veksler, and R. Zabih, Fast Approximate Energy Minimization via Graph Cuts, PAMI 2001
When cameras are not aligned:Stereo image rectification
• Reproject image planes onto a common• plane parallel to the line between optical centers• Pixel motion is horizontal after this transformation• Two homographies (3x3 transform), one for each input image
reprojection
•C. Loop and Z. Zhang. Computing Rectifying Homographies for Stereo Vision. IEEE Conf. Computer Vision and Pattern Recognition, 1999.
Brief Digression: Cross Product as Matrix Multiplication• Dot Product as matrix multiplication: Easy
!"!$!% & '"'$'% = !"'" + !$'$ + !%'%!"!$!% '"'$'% * = !"'" + !$'$ + !%'%
• Cross Product as matrix multiplication:
The Essential Matrix
Credit: William Hoff, Colorado School of Mines
Essential Matrix(Longuet-Higgins, 1981)
X
x x’
Epipolar constraint: Calibrated case
• Intrinsic and extrinsic parameters of the cameras are known, world coordinate system is set to that of the first camera
• Then the projection matrices are given by K[I | 0] and K’[R | t]• We can multiply the projection matrices (and the image points) by the
inverse of the calibration matrices to get normalized image coordinates:
XtRxKxX,IxKx ][0][ pixel1
normpixel1
norm =¢¢=¢== --
X
x x’ = Rx+t
Epipolar constraint: Calibrated case
R
t
The vectors Rx, t, and x’ are coplanar
= (x,1)T[ ] ÷÷ø
öççè
æ1
0x
I [ ] ÷÷ø
öççè
æ1x
tR
Epipolar constraint: Calibrated case
0])([ =´×¢ xRtx !x T [t×]Rx = 0
X
x x’ = Rx+t
baba ][0
00
´=úúú
û
ù
êêê
ë
é
úúú
û
ù
êêê
ë
é
--
-=´
z
y
x
xy
xz
yz
bbb
aaaaaa
Recall:
The vectors Rx, t, and x’ are coplanar
Epipolar constraint: Calibrated case
0])([ =´×¢ xRtx !x T [t×]Rx = 0
X
x x’ = Rx+t
!x TE x = 0
Essential Matrix(Longuet-Higgins, 1981)
The vectors Rx, t, and x’ are coplanar
X
x x’
Epipolar constraint: Calibrated case
• E x is the epipolar line associated with x (l' = E x)• Recall: a line is given by ax + by + c = 0 or
!x TE x = 0
úúú
û
ù
êêê
ë
é=
úúú
û
ù
êêê
ë
é==
1, where0 y
x
cba
T xlxl
X
x x’
Epipolar constraint: Calibrated case
• E x is the epipolar line associated with x (l' = E x)• ETx' is the epipolar line associated with x' (l = ETx')• E e = 0 and ETe' = 0• E is singular (rank two)• E has five degrees of freedom
!x TE x = 0
Epipolar constraint: Uncalibrated case
• The calibration matrices K and K’ of the two cameras are unknown
• We can write the epipolar constraint in terms of unknown normalized coordinates:
X
x x’
0ˆˆ =¢ xEx T xKxxKx ¢¢=¢= -- 11 ˆ,ˆ
Epipolar constraint: Uncalibrated caseX
x x’
Fundamental Matrix(Faugeras and Luong, 1992)
0ˆˆ =¢ xEx T
xKx
xKx
¢¢=¢
=-
-
1
1
ˆˆ
1with0 --¢==¢ KEKFxFx TT
Epipolar constraint: Uncalibrated case
• F x is the epipolar line associated with x (l' = F x)• FTx' is the epipolar line associated with x' (l = FTx')• F e = 0 and FTe' = 0• F is singular (rank two)• F has seven degrees of freedom
X
x x’
0ˆˆ =¢ xEx T 1with0 --¢==¢ KEKFxFx TT