ראייה ממוחשבת - 22928 (גרסת בטא 0.2)

Download Report

Transcript ראייה ממוחשבת - 22928 (גרסת בטא 0.2)

‫נתחיל בסגירת חוב‪...‬‬
‫מבוסס על השקפים של טל הסנר‬
Geometric vision
• Goal: Recovery of 3D structure
– Structure and depth are inherently ambiguous
from single views.
Geometric vision
• Goal: Recovery of 3D structure
– What cues in the image allow us to do this?
Slide credit: Svetlana Lazebnik
Shading
[Figure from Prados & Faugeras 2006]
Focus/defocus
Images from same
point of view,
different camera
parameters
3d shape / depth
estimates
[figs from H. Jin and P. Favaro, 2002]
Texture
[From A.M. Loh. The recovery of 3-D structure using visual texture patterns. PhD thesis]
Perspective effects
Image credit: S. Seitz
Motion
Figures from L. Zhang
http://www.brainconnection.com/teasers/?main=illusion/motion-shape
Estimating scene shape
• “Shape from X”: Shading, Texture, Focus, Motion…
• Stereo:
– shape from “motion” between two views
– infer 3d shape of scene from two (multiple) images
from different viewpoints
Main idea:
scene point
image plane
optical center
Geometry for a Simple Stereo System
• First, assuming parallel optical axes, known
camera parameters (i.e., calibrated cameras):
Slide credit: Kristen Grauman
B. Leibe
11
World
point
Depth of p
image point (left)
image point
(right)
Focal
length
optical
Center
(right)
optical center
(left)
baseline
Slide credit: Kristen Grauman
B. Leibe
12
Geometry for a Simple Stereo System
• Assume parallel optical axes, known camera
parameters (i.e., calibrated cameras). We can
triangulate via:
Similar triangles (pl, P, pr) and (Ol,
P, Or):
T   x r  xl 
Z  f
Z  f
disparity
Slide credit: Kristen Grauman
B. Leibe

T
Z
T
x r  xl
13
‫‪ Disparity‬ועומק‬
‫מרחק מהמצלמות (‪)depth‬‬
‫הבדל במיקומי הנקודה בתמונות‬
‫(‪)disparity‬‬
‫‪T‬‬
‫‪x r  xl‬‬
‫‪Z  f‬‬
‫מצלמות‬
‫‪disparity‬‬
Depth From Disparity
Image I(x,y)
Disparity map D(x,y)
Image I´(x´,y´)
(x´,y´)=(x+D(x,y), y)
B. Leibe
15
General Case With Calibrated Cameras
• The two cameras need not have parallel
optical axes.
vs.
Slide credit: Kristen Grauman, Steve Seitz
B. Leibe
16
Stereo Correspondence Constraints
• Given p in the left image, where can the
corresponding point p’ in the right image be?
Slide credit: Kristen Grauman
B. Leibe
17
Stereo Correspondence Constraints
• Given p in the left image, where can the
corresponding point p’ in the right image be?
Slide credit: Kristen Grauman
B. Leibe
18
Stereo Correspondence Constraints
Slide credit: Kristen Grauman
B. Leibe
19
Stereo Correspondence Constraints
• Geometry of two views allows us to constrain where the
corresponding pixel for some image point in the first view
must occur in the second view.
epipolar line
epipolar plane
epipolar line
• Epipolar constraint: Why is this useful?
– Reduces correspondence problem to 1D search along conjugate
epipolar lines.
Slide adapted from Steve Seitz
B. Leibe
20
Epipolar Geometry
• Epipolar Plane
• Baseline
• Epipoles
• Epipolar Lines
Slide adapted from Marc Pollefeys
21
Example
Slide credit: Kristen Grauman
B. Leibe
23
• For a given stereo rig, how do we express the
epipolar constraints algebraically?
B. Leibe
24
‫בניית המטריצה ההכרחית‬
‫‪P‬‬
‫‪pr‬‬
‫‪r‬‬
‫‪l‬‬
‫‪Or‬‬
‫‪pl‬‬
‫‪Ol‬‬
‫• נגדיר‬
‫• עבור מטריצת סיבוב ‪ ,R‬הקשר בין מיקום ‪P‬‬
‫במערכת הקואורדינטות השמאלית לימנית הוא‪:‬‬
‫‪T  O r  O l ‬‬
‫‪P r  R  Pl  T ‬‬
Rotation Matrix
Express 3d rotation as
series of rotations around
coordinate axes by angles
 ,  ,
Overall rotation is product
of these elementary
rotations:
R  R xR yR z
Slide credit: Kristen Grauman
‫בניית המטריצה ההכרחית‬
‫• שלושת הוקטורים ‪ T ,Pl‬ו‪ ( Pl  T ) -‬נמצאים על‬
‫אותו המישור‪ :‬המישור האפיפולרי‬
‫‪P‬‬
‫‪pr‬‬
‫‪Or‬‬
‫‪r‬‬
‫‪l‬‬
‫‪pl‬‬
‫‪Ol‬‬
Cross Product & Dot Product
• Vector cross product takes two vectors and returns a
third vector that’s perpendicular to both inputs.
• So here, c is perpendicular to both a and b, which
means the dot product = 0.
Slide credit: Kristen Grauman
‫בניית המטריצה ההכרחית‬
‫•‬
‫•‬
‫•‬
‫•‬
‫•‬
‫•‬
‫שלושת הוקטורים ‪ T ,Pl‬ו‪ ( Pl  T ) -‬נמצאים על‬
‫אותו המישור‪ :‬המישור האפיפולרי‬
‫‪  T  P ‬הוא וקטור הניצב למישור‬
‫מכאן‪ P  T   T  P   0 :‬‬
‫‪‬‬
‫‪‬‬
‫היות ו‪P  R  P  T  -‬‬
‫אזי‪R P  P  T :‬‬
‫נציב במשואה ונקבל‪:‬‬
‫‪l‬‬
‫‪P‬‬
‫‪T‬‬
‫‪l‬‬
‫‪l‬‬
‫‪pr‬‬
‫‪l‬‬
‫‪r‬‬
‫‪r‬‬
‫‪T‬‬
‫‪l‬‬
‫‪Or‬‬
‫‪r‬‬
‫‪Pr  T  Pl  Pr R T  Pl  0‬‬
‫‪T‬‬
‫‪T‬‬
‫‪T‬‬
‫‪R‬‬
‫‪pl‬‬
‫‪l‬‬
‫‪Ol‬‬
Matrix Form of Cross Product
30
Slide credit: Kristen Grauman
‫בניית המטריצה ההכרחית‬
 R Pr  T  Pl  Pr R T  Pl  0
T
T
T
‫• נשכתב באמצעות כפל מטריצות‬
R
P
T
Pr  T  Pl  Pr R  Tx  Pl  0
T
T
E  R  Tx 
pl
Ol
l
r
P r E Pl  0
T
pr
Or
–
‫– נגדיר‬
:‫– ונקבל‬
‫ נקראת‬E ‫• המטריצה‬
‫המטריצה ההכרחית‬
)Essential Matrix(
‫המטריצה ההכרחית‬
‫•‬
‫היות ונקודות במישורי התמונות נתונות‬
‫בקואורדינטות הומ'‪ ,‬נחליף ‪ P‬ב‪( p -‬שכן זהות עד‬
‫לכדי כפל בקבוע) ‪p E p  0‬‬
‫‪ u  Ep‬הוא ישר במישור התמונה הימנית אשר‬
‫‪pr‬‬
‫מובטח כי מכיל את הנקודה‬
‫‪ E‬שימושית כאשר נתונות לנו קואורדינטות נקודות‬
‫במישור התמונה‪.‬‬
‫לנו יש קואורדינטות פיקסלים בתמונה‪...‬‬
‫‪T‬‬
‫‪l‬‬
‫•‬
‫•‬
‫•‬
‫‪l‬‬
‫‪r‬‬
‫‪r‬‬
‫המטריצה היסודית‬
‫‪pr Fpl  0‬‬
‫‪T‬‬
‫• מטריצה היסודית ‪Fundamental Matrix F‬‬
‫• דומה באופייה למטריצה היסודית אך הפעם ‪ p‬ו‪p -‬‬
‫בקואורדינטות פיקסלים‬
‫‪F  M EM‬‬
‫•‬
‫• עבור ‪ M‬ו‪ M -‬מטריצות פנימיות של שתי‬
‫המצלמות‬
‫• חישוב המטריצה היסודית באמצעות "אלג' שמונה‬
‫הנקודות"‬
‫‪l‬‬
‫‪1‬‬
‫‪l‬‬
‫‪T‬‬
‫‪r‬‬
‫‪l‬‬
‫‪l‬‬
‫‪r‬‬
Fundamental matrix
• Relates pixel coordinates in the two views
• More general form than essential matrix: we remove need to
know intrinsic parameters
• If we estimate fundamental matrix from correspondences in
pixel coordinates, can reconstruct epipolar geometry without
intrinsic or extrinsic parameters
Grauman
Computing F from correspondences

F  M
p

right , int

right
EM
1
left . int

F p left  0
• Cameras are uncalibrated: we don’t know E or left or right
Mint matrices
• Estimate F from 8+ point correspondences.
Grauman
Computing F from correspondences
Each point
correspondence
generates one
constraint on F
p

right
F p left  0
We can re-write as:
Grauman
‫כיול מערכת סטראו‬
So, where to start with uncalibrated cameras?
Need to find fundamental matrix F and the correspondences (pairs of points
(u’,v’) ↔ (u,v)).
1) Find interest points in image
2) Compute correspondences
3) Compute epipolar geometry
4) Refine
Example from Andrew Zisserman
Stereo pipeline with weak calibration
1) Find interest points
Grauman
Stereo pipeline with weak calibration
2) Match points only using proximity
Grauman
Putative matches based on correlation
search
Grauman
‫עעעעעעעעעעעעע‬
‫עעעעעעעעעעעעע‬
‫עעעעעעעעעעעעע‬
‫עעעעעעעעע‬
RANSAC for robust estimation of the
fundamental matrix
• Select random sample of correspondences
• Compute F using them
– This determines epipolar constraint
• Evaluate amount of support – inliers within threshold distance
of epipolar line
• Choose F with most support (inliers)
Grauman
Putative matches based on correlation
search
Grauman
Pruned matches
• Correspondences consistent with epipolar geometry
Grauman
• Resulting epipolar geometry
Grauman
‫אז מה ראינו היום?‬
‫סיכום‬
‫• אנטומיה של מערכת סטראו‬
‫• גיאומטריה אפיפולרית‬
‫– האפיפול‪ ,‬הישר האפיפולרי‪ ,‬המישור האפיפולרי‬
‫• המטריצה ההכרחית‪ ,‬היסודית וכיול מע' סטראו‬
!‫ שיר המטריצה יסודית‬:‫לסיכום‬
The Fundamental Matrix Song
‫מקורות שקפים‬
‫• מלבד כל שצוין‪ ,‬שקפים רבים מבוססים על אלו‬
‫של‪:‬‬
‫– ‪B. Leibe‬‬
‫– ‪K. Grauman‬‬
‫– ‪D. Low‬‬
‫– ‪S. Lazebnik‬‬
‫– ‪A. Torralba‬‬
‫– ‪T. Darrell‬‬