Assignment - VIMS Laboratory - Main

Download Report

Transcript Assignment - VIMS Laboratory - Main

The Fundamental Matrix F
• Mapping of point in one image to epipolar line in other image x
! l’ is
expressed algebraically by the fundamental matrix F
line
point
= Fx
Since x’ is on l’, by the point-on-line definition we know that
x’T l’ = 0
Substitute l’ = Fx, we can thus relate corresponding points in the
camera pair (P, P’) to each other with the following:
x’T Fx = 0
• Write this as l’
•
•
Computer Vision : CISC 4/689
The fundamental matrix F
(courtesy: Marc Pollefeys, UNC)
geometric derivation
x' H π x
l'  e'x'  e' H π x  Fx
Computer Vision : CISC 4/689
mapping from
2-D to 1-D family
(rank 2)
Note: rank of skew
symmetric matrix is
even, so 2, so F’s
rank is 2
The Fundamental Matrix F
• F is 3 x 3, rank 2 (not invertible, in contrast to homographies)
– 7 DOF (homogeneity and rank constraint take away 2 DOF)
•
The fundamental matrix of (P’, P) is the transpose FT
NOW, can get implicit equation for any x, which is epipolar line)
x’
Computer Vision : CISC 4/689
from Hartley
& Zisserman
Computing Fundamental Matrix
u T Fu  0
(u’ is same as x in the prev. slide,
u’ is same as x)
Fundamental Matrix is singular with rank 2
In principal F has 7 parameters up to scale and can be estimated
from 7 point correspondences
Direct Simpler Method requires 8 correspondences
Computer Vision : CISC 4/689
The fundamental matrix F
(courtesy: Marc Pollefeys, UNC)
F is the unique 3x3 rank 2 matrix that
satisfies x’TFx=0 for all x↔x’
(i)
(ii)
(iii)
(iv)
(v)
Transpose: if F is fundamental matrix for (P,P’), then
FT is fundamental matrix for (P’,P)
Epipolar lines: l’=Fx & l=FTx’
Epipoles: on all epipolar lines, thus e’TFx=0, x
e’TF=0, similarly Fe=0
F has 7 d.o.f. , i.e. 3x3-1(homogeneous)-1(rank2)
F is a correlation, projective mapping from a point x to
a line l’=Fx (not a proper correlation, i.e. not invertible)
i.e, mapping is (singular) correlation (projective
mapping from points to lines)
Computer Vision : CISC 4/689
Estimating Fundamental Matrix
The 8-point algorithm
u Fu  0
T
Each point correspondence can be expressed as a linear equation
 F11
u v 1 F21
 F31
F12
F22
F32
F13  u 
F23   v   0
F33   1 
 F11 
F 
 12 
 F13 
 
 F21 
uu uv u uv vv v u v 1 F22   0
 
 F23 
F 
 31 
 F32 
F 
 33 
Computer Vision : CISC 4/689
The 8-point Algorithm
Lot of squares, so numbers
have varied range, from say
1000 to 1. So pre-normalize.
And RANSaC!
Computer Vision : CISC 4/689
Computing F: The Eight-point
Algorithm
• Input: n point correspondences ( n >= 8)
– Construct homogeneous system Ax= 0 from
pr TF pl  0
• x = (f11,f12, ,f13, f21,f22,f23 f31,f32, f33) : entries in F
• Each correspondence gives one equation
• A is a nx9 matrix (in homogenous format)
– Obtain estimate F^ by SVD of A
A  UDVT
• x (up to a scale) is column of V corresponding to the least
singular value
– Enforce singularity constraint: since Rank (F) = 2
• Compute SVD of F^
ˆ  UDVT
F
• Set the smallest singular value to 0: D -> D’
• Correct estimate of F :
F'  UD' VT
• Output: the estimate of the fundamental matrix, F’
• Similarly we can compute E given intrinsic parameters
Computer Vision : CISC 4/689
Locating the Epipoles from F
pr TF pl  0 el lies on all the epipolar
lines of the left image
pr TFel  0
Fel  0
P
Pl
Epipolar Plane
True For every
pr
F is not identically zero
• Input: Fundamental Matrix F
Pr
Epipolar Lines
pl
Ol
p
r
el
er
Epipoles
T
F  UDV
– Find the SVD of F
– The epipole el is the column of V corresponding to the null singular
value (as shown above)
– The epipole er is the column of U corresponding to the null singular
value
• Output: Epipole el and er
Computer Vision : CISC 4/689
Or
Special Case:
Translation along Optical Axis
• Epipoles coincide at focus of expansion
• Not the same (in general) as vanishing point of scene lines
Computer Vision : CISC 4/689
from Hartley & Zisserman
Finding Correspondences
• Epipolar geometry limits where feature in one image can
be in the other image
– Only have to search along a line
Computer Vision : CISC 4/689
Simplest Case
•
•
•
•
Image planes of cameras are parallel.
Focal points are at same height.
Focal lengths same.
Then, epipolar lines are horizontal scan lines.
Computer Vision : CISC 4/689
We can always achieve this geometry
with image rectification
• Image Reprojection
– reproject image planes onto common
plane parallel to line between optical centers
•
Notice, only focal point of camera really matters
Computer Vision : CISC 4/689
(Seitz)
Stereo Rectification
P
Stereo
System with Parallel Optical Axes
Epipoles are at infinity
Pl
Pr

Horizontal epipolar lines

Y’l
p’
r
p’ l
Y’r
Z’l
• Rectification
X’l
Ol T
X’r
Or
– Given a stereo pair, the intrinsic and extrinsic parameters, find the image
transformation to achieve a stereo system of horizontal epipolar lines
– A simple algorithm: Assuming calibrated stereo cameras
Computer Vision : CISC 4/689
Z’r
Stereo Rectification
P
• Algorithm
– Rotate both left and right
camera so that they share
the same X axis : Or-Ol =
T
– Define a rotation matrix
Rrect for the left camera
– Rotation Matrix for the
right camera is RrectRT
– Rotation can be
implemented by image
transformation
Pl
p
Yl
p
l
Xl
X’l
Pr
Zl
r
Zr
Ol T
Or
R, T
Xl’ = T_axis,
Computer Vision : CISC 4/689
Yr
Yl’ = Xl’xZl,
Xr
Z’l = Xl’xYl’
Stereo Rectification
P
• Algorithm
– Rotate both left and right
camera so that they share
the same X axis : Or-Ol =
T
– Define a rotation matrix
Rrect for the left camera
– Rotation Matrix for the
right camera is RrectRT
– Rotation can be
implemented by image
transformation
Pl
p
Yl
p
l
Xl
X’l
Pr
Zl
r
Zr
Ol T
Or
R, T
Xl’ = T_axis,
Computer Vision : CISC 4/689
Yr
Yl’ = Xl’xZl,
Xr
Z’l = Xl’xYl’
Stereo Rectification
P
• Algorithm
– Rotate both left and right
camera so that they share
the same X axis : Or-Ol =
T
– Define a rotation matrix
Rrect for the left camera
– Rotation Matrix for the
right camera is RrectRT
– Rotation can be
implemented by image
transformation
Pl
Y’l
Pr
p’
r
p’ l
Y’r Z
r
Z’l
X’l
X’r
Ol T
R, T
T’ = (B, 0, 0),
Computer Vision : CISC 4/689
Or
Public Library, Stereoscopic Looking Room, Chicago, by Phillips, 1923
Computer Vision : CISC 4/689
Teesta suspension
bridge-Darjeeling,
India
Computer Vision
: CISC 4/689
Mark Twain at Pool
Table", no
date,: UCR
Computer
Vision
CISCMuseum
4/689 of Photography
Woman getting eye exam during immigration procedure at Ellis
Computer
CISC 4/689
Island, c. 1905
- 1920Vision
, UCR :Museum
of Phography
Stereo matching
• attempt to match every pixel
• use additional constraints
Computer Vision : CISC 4/689
A Simple Stereo System
LEFT CAMERA
RIGHT CAMERA
baseline
Right image:
target
Left image:
reference
disparity
Depth Z
Elevation Zw
Zw=0
Computer Vision : CISC 4/689
Let’s discuss reconstruction with this geometry before correspondence, because
it’s much easier.
( -ve,  +ve, refer
previous slide fig.)
P
Similarity of triangles:
Xl,f -> X,Z
xl,yl=(f X/Z, f Y/Z)
Xr,yr=(f (X-T)/Z, f Y/Z)
d=xl-xr=f X/Z – f (X-T)/Z
Z
f
xl
Ol
xr
pl
Disparity:
pr
X
(T-X)
T
Or
But moving to Then given
Left camera makes
and Y.
It –(T-X)
Z, we can compute X
T is the stereo baseline
d measures the difference in retinal position between corresponding points
Computer Vision : CISC 4/689
(Camps)
Correspondence: What should we match?
•
•
•
•
Objects?
Edges?
Pixels?
Collections of pixels?
Computer Vision : CISC 4/689
Extracting Structure
•
•
The key aspect of epipolar geometry is its linear constraint on where a point in one
image can be in the other
By correlation-matching pixels (or features) along epipolar lines and measuring the
disparity between them, we can construct a depth map (scene point depth is inversely
proportional to disparity)
courtesy of P. Debevec
View 1
View 2
Computer Vision : CISC 4/689
Computed depth map
Correspondence: Photometric constraint
• Same world point has same intensity in both images.
– Lambertian fronto-parallel
– Issues:
• Noise
• Specularity
• Foreshortening
Computer Vision : CISC 4/689
Using these constraints we can use matching
for stereo
For each epipolar line
For each pixel in the left image
• compare with every pixel on same epipolar line in right image
• pick pixel with minimum match cost
• This will never work, so:
Improvement: match windows
(Seitz)
Computer Vision : CISC 4/689
Aggregation
• Use more than one pixel
• Assume neighbors have similar disparities*
– Use correlation window containing pixel
– Allows to use SSD, ZNCC, etc.
Computer Vision : CISC 4/689
?
=
Comparing Windows:
f
Most
popular
For each window, match to closest window on epipolar
line in other image.
(Camps)
Computer Vision : CISC 4/689
g
Comparing image regions
Compare intensities pixel-by-pixel
I(x,y)
I´(x,y)
Dissimilarity measures
Sum of Square Differences
Computer Vision : CISC 4/689
Comparing image regions
Compare intensities pixel-by-pixel
I(x,y)
I´(x,y)
Similarity measures
Zero-mean Normalized Cross Correlation
Computer Vision : CISC 4/689
Aggregation window sizes
Small windows
• disparities similar
• more ambiguities
• accurate when correct
Large windows
• larger disp. variation
• more discriminant
• often more robust
• use shiftable windows to deal with
discontinuities
Computer Vision : CISC 4/689
(Illustration from Pascal Fua)
Window size
W=3
•
Effect of window size
Better results with adaptive window
•
•
(Seitz)
W = 20
T. Kanade and M. Okutomi, A Stereo Matching
Algorithm with an Adaptive Window: Theory and
Experiment,, Proc. International Conference on
Robotics and Automation, 1991.
D. Scharstein and R. Szeliski. Stereo matching with
nonlinear diffusion. International Journal of
Computer Vision, 28(2):155-174, July 1998
Computer Vision : CISC 4/689
Correspondence Using Windowbased matching
scanline
Left
SSD error
Right
disparity
Computer Vision : CISC 4/689
Sum of Squared (Pixel) Differences
Left
Right
wL
wR
m
wL
wR
IL
IR
m
( xL , yL ) ( xL  d , yL )
wL and wR are correspond ing m by m windows of pixels.
We define the window function :
Wm ( x, y )  {u, v | x  m2  u  x  m2 , y  m2  v  y  m2 }
The SSD cost measures the intensity difference as a function of disparity :
C r ( x, y , d ) 
2
[
I
(
u
,
v
)

I
(
u

d
,
v
)]
 L
R
( u ,v )Wm ( x , y )
Computer Vision : CISC 4/689
Image Normalization
•
•
•
Even when the cameras are identical models, there can be differences in gain and sensitivity.
The cameras do not see exactly the same surfaces, so their overall light levels can differ.
For these reasons and more, it is a good idea to normalize the pixels in each window:
I
I
1
Wm ( x , y )
Wm ( x , y )

 I (u, v)
Average pixel
( u ,v )Wm ( x , y )
2
[
I
(
u
,
v
)]

Window magnitude
( u ,v )Wm ( x , y )
ˆI ( x, y )  I ( x, y )  I
I  I W ( x, y )
Normalized pixel
m
Computer Vision : CISC 4/689
Stereo results
– Data from University of Tsukuba
Scene
(Seitz)
Ground truth
Computer Vision : CISC 4/689
Results with window correlation
Window-based matching
(best window size)
(Seitz)
Computer Vision : CISC 4/689
Ground truth
Results with better method
State of the art method
Boykov et al., Fast Approximate Energy Minimization via Graph Cuts,
International Conference on Computer Vision, September 1999.
Computer Vision : CISC 4/689
(Seitz)
Ground truth