Professional Documents
Culture Documents
07 ShapefX
07 ShapefX
Readings:
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
1
Shape from X
or
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
2
Ill-posed
• In trying to extract 3d structure from 2d images, vision is
an ill-posed problem.
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
3
Ill-posed
• In trying to extract 3d structure from 2d images, vision is
an ill-posed problem.
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
4
Ill-posed
• In trying to extract 3d structure from 2d images, vision is
an ill-posed problem.
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
5
Ill-posed
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
6
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
7
Depth Cues
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
8
Shape from x
Profile (3D Scanning)
Shape from Shading
Shape from Shadow
Structured Light
Shape from Focus
Photometric Stereo
Interferometry
Stereopsis
Shape from Motion
Tomography (CAT)
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
9
Shape from Stereo
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
10
Why Stereo Vision?
2D images project 3D points into 2D:
P
Q
P’=Q’
O
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
11
Stereo Vision
Refers to the ability of:
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
12
Stereograms
• Invented by Sir Charles Wheatstone, 1838
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
13
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
14
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
15
Random Dot Stereograms
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
16
Remember: Pinhole Camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
17
camera
Perspective projection world
y
z
y’
Cartesian coordinates:
We have, by similar triangles, that
(x, y, z) -> (f x/z, f y/z, -f)
Ignore the third coordinate, and get
x y
(x, y,z) → ( f ,f )
z z
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
18
Other projection models:
Orthographic projection
( x, y , z ) → ( x, y )
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
19
Other projection models:
Weak perspective
• Issue
– perspective effects, but not
over the scale of individual
objects
– collect points into a group
at about the same depth,
then divide each point by
the depth of its group
– Adv: easy
– Disadv: only approximate
fx fy
( x, y, z ) → ,
z0 z0
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
20
Recap: Camera calibration
Y
Y’
Z O
O’ X’ X
Z’
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
21
Final perspective projection
Camera extrinsics: where your camera is relative
to the world. Changes if you move the camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
22
Camera calibration
• Need to estimate P
• How many parameters does P have?
– Size of P : 3 x 4
– But:
– P can only be known upto a scale
– 3*4 - 1 = 11 parameters
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
23
Recovering Depth Information:
P
Q
P’1 P’2=Q’2
Q’1
O2
O1
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
24
Stereo Vision Problems:
Correspondence Problem:
– Determining which pixel on the left corresponds to which pixel on
the right.
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
25
Triangulation
• Suppose we have two cameras
– Calibrated: parameters known
• And a pair of corresponding pixels
• Find 3D location of point!
(x1,y1)
(x2,y2)
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
26
Binocular stereo
• Given two calibrated cameras
– Find pairs of corresponding pixels
– Use corresponding image locations to set
up equations on world coordinates
– Solve!
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
27
Binocular stereo
• General case: cameras can be arbitrary locations and
orientations
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
28
Binocular stereo
• Special case: cameras are parallel to each other and
translated along X axis
X axis
Z axis
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
29
Stereo head
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
30
A simple stereo system
P
Z
x xr
f l
pl pr Disparity:
Ol Or
T
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
31
A simple stereo system
P
Z
x xr
f l
pl pr
Ol Or •Depth is inversely
proportional to disparity
T
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
32
Disparity
Images Disparity
Position 1
d1
Position 2
d2
Position 3
d3
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
33
The math
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
34
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
35
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
36
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
37
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
38
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
39
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
40
Perspective projection in rectified
cameras
• Without loss of generality, assume origin is at pinhole
of 1st camera
X coordinate differs by tx/Z
Horst Bischof
Professor
Y coordinate is the same!
Horst Cerjak, 19.12.2005 Computer Vision I SS21
41
Perspective projection in rectified
cameras
• X coordinate differs by tx/Z
• That is, difference in X coordinate is inversely
proportional to depth
• Difference in X coordinate is called disparity
• Translation between cameras (tx) is called baseline
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
42
The disparity image
• For pixel (x,y) in one image, only need to know
disparity to get correspondence
• Create an image with color at (x,y) = disparity
right image
disparity
left image
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
43
Perspective projection in rectified
cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
44
Finding Correspondences:
P Q
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
45
Finding Correspondences:
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
46
NCC - Normalized Cross Correlation
• Lighting and color change pixel intensities
• Example: increase brightness / contrast
• 𝐼 ′ = 𝛼𝐼 + 𝛽
• Subtract patch mean: invariance to 𝛽
• Divide by norm of vector: invariance to 𝛼
• 𝑥′ = 𝑥− < 𝑥 >
𝑥′
• 𝑥′′ =
||𝑥′||
• similarity = 𝑥 ′′ ⋅ 𝑦′′
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
47
Cross-correlation of neighborhood
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
48
left image band
right image band
1
0.5 cross
correlation
Horst Bischof
Professor Horst Cerjak, 19.12.2005 x Computer Vision I SS21
49
target region
0.5 cross
correlation
Horst Bischof
Professor Horst Cerjak, 19.12.2005 x Computer Vision I SS21
50
Results with window search
Data
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
51
Hierarchical Matching
32 32 Coarse to fine Matching:
Stereo
32
64
matching
– Repeat till the full resolution
left(n-1) right(n-1) depth(n-1) has been reached
512 512
Stereo
512
512
matching
left(0) right(0) depth(0)
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
52
Dense 3D Models
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
53
Perspective projection in rectified
cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
55
Rectifying cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
56
Rotating cameras
• Assume K is identity
• Assume coordinate system at camera pinhole
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
57
Rotating cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
58
Rotating cameras
Rotation matrix
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
60
Rectifying cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
61
Rectifying cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
62
Rectifying cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
63
Rectifying cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
64
Perspective projection in rectified
cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
65
Perspective projection in rectified
cameras
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
67
Epipolar constraint
True in general!
• Given pixel (x,y) in one image, corresponding pixel in the
other image must lie on a line
• Line function of (x,y) and parameters of camera
• These lines are called epipolar line
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
68
Epipolar geometry
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
69
Epipolar geometry - why?
• For a single camera, pixel in image plane must
correspond to point somewhere along a ray
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
70
Epipolar geometry
Given an image point in one view, where is the
corresponding point in the other view?
?
epipolar line
C /
epipole C
baseline
• A point in one view “generates” an epipolar line in the other
view
• The corresponding point lies on this line
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
71
Epipolar line
Epipolar constraint
• Reduces correspondence problem to 1D search along an
epipolar line
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
72
Epipolar lines
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
73
Epipolar lines
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
74
Epipolar lines
Epipole
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
75
Epipolar geometry continued
Epipolar geometry is a consequence of the coplanarity of the camera
centres and scene point
x x/
C C/
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
76
Nomenclature
X
l/ right epipolar line
left epipolar line x
x/
e e/
C C/
• The epipolar line l/ is the image of the ray through x
• The epipole e is the point of intersection of the line joining the camera centres
with the image plane
this line is the baseline for a stereo rig, and
the translation vector for a moving camera
• The epipole is the image of the centre of the other camera: e = PC/ , e/ = P/C
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
77
The epipolar pencil
X
e e /
baseline
As the position of the 3D point X varies, the epipolar planes “rotate” about
the baseline. This family of planes is known as an epipolar pencil (a pencil is
a one parameter family).
All epipolar lines intersect at the epipole.
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
78
The epipolar pencil
X
e e /
baseline
As the position of the 3D point X varies, the epipolar planes “rotate” about
the baseline. This family of planes is known as an epipolar pencil (a pencil is
a one parameter family).
All epipolar lines intersect at the epipole.
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
79
Epipolar geometry - the math
Homogenous Homogenous
coordinates of point in coordinates of point in
image 2 image 1
Essential
matrix
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
80
Epipolar geometry - the math
Fundamental matrix
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
81
Fundamental matrix
Fundamental matrix
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
82
Estimating F
x' Fx = 0
for any pair of matches x and x’ in two images.
f11 f12 f13
• Let x=(u,v,1)T and x’=(u’,v’,1)T, F = f 21 f 22 f 23
f 31 f 32 f 33
each match gives a linear equation
uu' f11 + vu' f12 + u ' f13 + uv' f 21 + vv' f 22 + v' f 23 + uf31 + vf 32 + f 33 = 0
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
84
8-point algorithm
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
85
Active stereo with structured light
camera 1 camera 1
projector projector
camera 2
• Project “structured” light patterns onto the object
– simplifies the correspondence problem
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
86
Microsoft Kinect
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
87
Laser scanning
• Optical triangulation
– Project a single stripe of laser light
– Scan it across the surface of the object
– This is a very precise version of structured light scanning
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
Source: S. Seitz 88
Laser scanned models
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
92
Radiance
• Pixels measure radiance
This pixel
Measures radiance along this ray
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
93
Where do the rays come from?
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
94
Light rays interacting with a surface
• Light of radiance 𝐿𝑖 comes from light source at an
incoming direction 𝜃𝑖
• It sends out a ray of radiance 𝐿𝑟 in the outgoing
direction 𝜃𝑟
• How does 𝐿𝑟 relate to 𝐿𝑖 ?
• N is surface normal
• L is direction of light, making 𝜃𝑖
with normal
𝜃𝑖 𝜃 • V is viewing direction, making 𝜃𝑟
𝑟 with normal
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
95
Light rays interacting with a surface
• N is surface normal
• L is direction of light, making 𝜃𝑖
with normal
𝜃𝑖 𝜃 • V is viewing direction, making 𝜃𝑟
𝑟 with normal
Output radiance
along V 𝐿𝑟 = 𝜌 𝜃𝑖 , 𝜃𝑟 𝐿𝑖 cos 𝜃𝑖 Incoming
irradiance along L
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
96
Light rays interacting with a surface
𝜃𝑖 𝜃
𝐿𝑟 = 𝜌 𝜃𝑖 , 𝜃𝑟 𝐿𝑖 cos 𝜃𝑖
𝑟
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
98
Special case 2: Matte surface
• 𝜌 𝜃𝑖 , 𝜃𝑟 = 𝜌0
• Also called “Lambertian surfaces”
• Reflected light is independent of viewing direction
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
99
Lambertian surfaces
𝜃𝑖 𝜃
• 𝜌 is called albedo 𝑟
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
101
Lambertian surfaces
Intrinsic Image
Decomposition
Shading image
Reflectance
image
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
102
Reconstructing Lambertian surfaces
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
103
Solution 1: Recovery from a single image
• Step 1: Intrinsic image decomposition
– Reflectance image 𝜌 𝑥, 𝑦
– Shading image
– Decomposition relies on priors
on reflectance image
• What kind of priors?
– Reflectance image captures
the “paint” on an object
surface
– Surfaces tend to be of uniform
color with sharp edges when
color changes
– Called Shape-From-Shading
– Relies on priors on shape: shapes are
smooth
Far
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
Near 105
Limitations
• Big problems
– doesn’t work for shiny things, semi-translucent
things
– shadows, inter-reflections
• Smaller problems
– camera and lights have to be distant
– calibration requirements
• measure light source directions, intensities
• camera response function
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
106
Solution 2: Recovery from multiple
images
N
L3 L2
L1
V
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
108
Solving the equations
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
109
More than three lights
• Get better results by using more lights
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
111
Results…
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
112
Shape from Focus
Shape from Focus:
Move object until in focus
How to measure focus?
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
113
Form aus „Schärfe“ -
Shape-from-Focus
Microscopy
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
114
Shape from Texture
Interpretation of Scene?
Depth Perception by Size of
Squares
Texture contains 3D
Information
Horst Bischof
Professor Horst Cerjak, 19.12.2005 Computer Vision I SS21
115