Pose Tracking I: Gordon Wetzstein! Stanford University!
Pose Tracking I: Gordon Wetzstein! Stanford University!
Gordon Wetzstein!
Stanford University!
!
• What is a pose? !
• 3D position of the tracked object !
• 3D orientation of the tracked object, e.g. using
quaternions or Euler angles!
• Why? So we can map the movement of our head to the motion of the
camera in a virtual environment – motion parallax!!
Overview of Positional Tracking!
!
“outside-in tracking”: external sensors, cameras, or markers are
required (i.e. tracking constrained to specific area)!
• used by most VR headsets right now, but everyone is
feverishly working on insight-out tracking!!
Marker-based Tracking!
• mechanical tracking!
• ultra-sonic tracking!
• magnetic tracking!
• optical tracking!
• GPS!
• WIFI positioning!
• marker tracking!
• ...!
Positional Tracking - Mechanical!
some mechanical
linkage, e.g.!
• fakespace BOOM!
• microscribe!
Positional Tracking - Mechanical!
pros:!
• super low latency!
• very accurate!
!
cons:!
• cumbersome!
• “wired” by design!
Positional Tracking – Ultra-sonic!
• 1 transmitter, 3 receivers à triangulation!
Ivan Sutherland’s “Ultimate Display”!
Logitech 6DOF !
Positional Tracking – Ultra-sonic!
pros:!
• can be light, small, inexpensive!
!
cons:!
• line-of-sight constraints!
• susceptible to acoustic interference!
• low update rates!
Positional Tracking - Magnetic!
pros:!
• small, low cost, low latency sensors!
• no line-of-sight constraints!
!
cons:!
3 axis Helmholtz coil!
https://www.ifixit.com/Teardown/Magic+Leap+One+Teardown/112245!
Positional Tracking - Optical!
Oculus Rift !
• both Oculus Rift and HTC Vive https://www.ifixit.com/Teardown/
Oculus+Rift+CV1+Teardown/60612!
2D
projections!
⎛ xn ⎞
⎜ n ⎟
i
⎜⎝ yi ⎟⎠
Understanding Pose Estimation!
2D
projections!
Understanding Pose Estimation!
⎜⎝ yi ⎟⎠
4. estimate pose with
nonlinear Levenberg-
Marquardt method
(next class)!
Understanding Pose Estimation!
1. how to get projected • HTC Lighthouse!
2D coordinates?!
• VRduino!
2. image formation!
3. estimate pose with
linear homography
method!
4. estimate pose with
nonlinear Levenberg-
Marquardt method
(next class)!
HTC Lighthouse!
https://www.youtube.com/watch?v=J54dotTt7k0!
HTC Lighthouse!
https://www.youtube.com/watch?v=J54dotTt7k0!
HTC Lighthouse – Base Station!
http://gizmodo.com/this-is-how-valve-s-amazing-lighthouse-tracking-technol-1705356768!
HTC Lighthouse – Base Station!
important specs:!
• runs at 60 Hz !
• i.e. horizontal & vertical update combined 60 Hz !
• broadband sync pulses in between each laser sweep
(i.e. at 120 Hz)!
• each laser rotates at 60 Hz, but offset in time!
• useable field of view: 120 degrees!
HTC Lighthouse – Base Station!
• can use up to 2 base stations simultaneously via time-division
multiplexing (TDM) !
• base station modes:!
A: TDM slave with cable sync!
B: TDM master!
C: TDM slave with optical sync!
HTC!
HTC Lighthouse – Base Station!
• sync pulse periodically emitted (120 times per second)!
• each sync pulse indicates beginning of new sweep !
• length of pulse also encodes additional 3 bits of information:!
https://github.com/nairol/LighthouseRedox/blob/master/docs/Light%20Emissions.md#sync-pulse!
VRduino!
!
VRduino!
VRduino!
IMU!
Teensy 3.2!
VRduino!
Lighthouse!
Select!
VRduino!
Photodiode 0! Photodiode 1!
Photodiode 2!
Photodiode 3!
x=-42mm, y=25mm!
VRduino! x=42mm, y=25mm!
pins 9,10!
pins 20,21!
pins 5,6!
pins 22,23!
VRduino!
power (3.3V)!
ground!
VRduino!
Pin!
Breakout!
VRduino!
Side View!
0°
y
z
laser sweep
direction!
current laser
position! −90°
How to Get the 2D Coordinates?!
• at time of respective sync pulse,
laser is at 90° horizontally and -90°
vertically!
• each laser rotates 360° in 1/60 sec!
0°
optical axis
(principle direction)!
laser sweep
0°
direction!
y
z
laser sweep
direction!
x starting laser
position! 90°
z
How to Get the 2D Coordinates?!
• convert from ticks to angle first and
raw number of ticks from photodiode! then to relative position on plane at
unit distance!
# ticks
Δt [ sec ] =
⎡ ticks ⎤ Top View!
48,000,000 ⎢ CPU speed!
⎣ sec ⎥⎦ α
3D
pi,x/y
offset from sync pulse!
laser sweep angle
when it hits the
2D
Δt [ sec ]
pi,x/y photodiode!
360
α [°] = − + [°]
1 4
60 ⎡ sec ⎤ 1
360 ⎢⎣ ° ⎥⎦
x starting laser
time per 1 revolution! position! 90°
z
How to Get the 2D Coordinates?!
• convert from ticks to angle first and
then to relative position on plane at
unit distance!
⎛ α ⎞
2D
pi,x/y = tan ⎜ ⋅ 2π ⎟
⎝ 360 [ ° ] ⎠
Top View!
α
3D
pi,x/y
offset from sync pulse!
laser sweep angle
when it hits the
2D
Δt [ sec ]
pi,x/y photodiode!
360
α [°] = − + [°]
1 4
60 ⎡ sec ⎤ 1
360 ⎢⎣ ° ⎥⎦
x starting laser
time per 1 revolution! position! 90°
z
How to Get the 2D Coordinates?!
measured 2D
projections!
⎛ xn ⎞ ⎛ xn ⎞
⎜ n ⎟ ⎜ n ⎟
i i
⎜⎝ yi ⎟⎠ ⎜⎝ yi ⎟⎠
normalized
camera frame!
Image Formation – 3D Arrangement!
1. transform 3D point into view space:!
⎛ xc ⎞ ⎛ xi ⎞
⎛ 1 0 0 ⎞ ⎛ r11 r12 r13 tx ⎞ ⎜ ⎟
⎜ c ⎟
i
⎛ xi ⎞
⎜ yi ⎟ = ⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22 r23
⎟
ty ⎟ ⋅ ⎜
yi ⎟
⎜ ⎟
⎜ c ⎟ ⎜⎝ 0 0 −1 ⎟ ⎜ ⎜ zi ⎟ ⎜ yi ⎟
⎠ ⎜⎝ r31 r32 r33 t z ⎟⎠ ⎜ ⎟
⎝ zi ⎠ ⎝ 1 ⎠ ⎜ zi ⎟
⎝ ⎠
“modelview matrix”!
“projection matrix”!
3x3 rotation matrix and ⎛ xn ⎞
⎜ n ⎟
i
translation 3x1 vector!
This is the homogeneous ⎜⎝ yi ⎟⎠
coordinate, which we
could also call w! ⎛ xic ⎞
⎛ xn ⎞ ⎜ ⎟
zic ⎟
⎜ n ⎟ =⎜
i
2. perspective divide:!
⎜⎝ yi ⎟⎠ ⎜ yic ⎟
⎜ ⎟
⎜⎝ zic ⎟⎠
Image Formation – 2D Arrangement!
1. transform 3D point into view space:!
⎛ xc ⎞ ⎛ xi ⎞
⎛ 1 0 0 ⎞ ⎛ r11 r12 r13 tx ⎞
⎜ c ⎟ ⎟ ⎜ ⎟
i
⎜ c ⎟ ⎜⎝ 0 0 −1 ⎟ ⎜ ⎜ 0 ⎟
⎜
⎜ yi ⎟
⎟
⎠ ⎜⎝ r31 r32 r33 t z ⎟⎠ ⎜ ⎟
⎝ zi ⎠ ⎝ 1 ⎠ ⎜⎝ 0 ⎟⎠
⎛ 1 0 0 ⎞ ⎛ r11 r12 t x ⎞ ⎛ xi ⎞
=⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟
t y ⎟ ⋅ ⎜ yi ⎟ ⎛ xn ⎞
⎜ ⎟ ⎜ ⎜ ⎟
⎜ n
i
⎟
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 ⎟
t z ⎠ ⎝ 1 ⎟⎠
⎜
⎜⎝ yi ⎟⎠
⎛ xic ⎞
⎛ xn ⎞ ⎜ ⎟
zic ⎟
⎜ n ⎟ =⎜
i
2. perspective divide:!
⎜⎝ yi ⎟⎠ ⎜ yic ⎟
⎜ ⎟
⎜⎝ zic ⎟⎠
Image Formation – 2D Arrangement!
r112 + r212 + r312 = 1
• all rotation matrices are orthonormal, i.e.!
r122 + r222 + r322 = 1
rotation R! translation T!
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22 ty ⎟
⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠
The Homography Matrix!
r112 + r212 + r312 = 1
• all rotation matrices are orthonormal, i.e.!
r122 + r222 + r322 = 1
rotation R! translation T!
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎟ ⋅ ⎜ r21 ⎟
⎜ 0 1 0 ⎜ ⎟ let’s call this
r22 ty ⎟ = ⎜ h4 h5 h6 ⎟
⎜ ⎟ ⎜ “homography matrix”!
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 h9 ⎟⎠
H
Understanding Pose Estimation!
1. how to get projected
2D coordinates?!
2. image formation!
3. estimate pose with
linear homography • how to compute the
method! homography matrix!
4. estimate pose with • how to get position and
nonlinear Levenberg- rotation from that matrix!
Marquardt method
(next class)!
The Homography Matrix!
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎟ ⋅ ⎜ r21 ⎟ ⎜ ⎟ estimate these 8
⎜ 0 1 0 r22 t y ⎟ = s ⎜ h4 h5 h6 ⎟ homography matrix
⎜ ⎟ ⎜ elements!!
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Pose Estimation via Homography!
⎛ xi ⎞
• image formation changes to! ⎜ ⎟
⎜ yi ⎟
⎜⎝ 0 ⎟⎠
⎛ xc ⎞ ⎛ h1 h2 h3 ⎞ ⎛ xi ⎞
⎜ c ⎟
i
⎜ ⎟
⎜ yi ⎟ = s ⎜ h4 h5 h6 ⎟ ⋅ ⎜ yi ⎟
⎜ ⎟
⎜ c ⎟ ⎜ h7 h8 1 ⎟⎠ ⎜⎝ 1 ⎟⎠
⎝ zi ⎠ ⎝
⎛ xn ⎞
homography matrix with
⎜ n ⎟
i
8 unknowns!! ⎜⎝ yi ⎟⎠
Pose Estimation via Homography!
⎛ xi ⎞
• image formation changes to! ⎜ ⎟
⎜ yi ⎟
⎜⎝ 0 ⎟⎠
⎛ xc ⎞ ⎛ h1 h2 h3 ⎞ ⎛ xi ⎞
⎜ c ⎟
i
⎜ ⎟
⎜ yi ⎟ = s ⎜ h4 h5 h6 ⎟ ⋅ ⎜ yi ⎟
⎜ ⎟
⎜ c ⎟ ⎜ h7 h8 1 ⎟⎠ ⎜⎝ 1 ⎟⎠
⎝ zi ⎠ ⎝
⎛ xn ⎞
⎜ n ⎟
i
⎜⎝ yi ⎟⎠
⎛ xic ⎞ ⎛ h1 xi + h2 yi + h3 ⎞
⎜ ⎟
⎛ xn ⎞ zic ⎟ ⎜ h7 xi + h8 yi + 1 ⎟
⎜ n ⎟ =⎜ =⎜ ⎟
i
⎜⎝ yi ⎟⎠ ⎜ yic ⎟ ⎜ h4 xi + h5 yi + h6 ⎟
⎜ ⎟ ⎜ ⎟
⎜⎝ zic ⎟⎠ ⎝ h7 xi + h8 yi + 1 ⎠
Pose Estimation via Homography!
• multiply by denominator!
⎛ xic ⎞ ⎛ h1 xi + h2 yi + h3 ⎞
⎜ ⎟
⎛ xn ⎞ zic ⎟ ⎜ h7 xi + h8 yi + 1 ⎟ xin ( h7 xi + h8 yi + 1) = h1 xi + h2 yi + h3
⎜ n ⎟ =⎜ =⎜ ⎟
i
⎜⎝ yi ⎟⎠ ⎜ yic ⎟ ⎜ h4 xi + h5 yi + h6 ⎟ yin ( h7 xi + h8 yi + 1) = h4 xi + h5 yi + h6
⎜ ⎟ ⎜ ⎟
⎜⎝ zic ⎟⎠ ⎝ h7 xi + h8 yi + 1 ⎠
Pose Estimation via Homography!
• reorder equations!
xin ( h7 xi + h8 yi + 1) = h1 xi + h2 yi + h3
yin ( h7 xi + h8 yi + 1) = h4 xi + h5 yi + h6
Pose Estimation via Homography!
• 8 unknowns (red) but only 2 measurements (blue) per 3D-to-2D
point correspondence!
A h b
Get Position from Homography Matrix!
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Position from Homography Matrix!
2
s=
h12 + h42 + h72 + h22 + h52 + h82
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Position from Homography Matrix!
t x = sh3 , t y = sh6 , t z = −s
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Rotation from Homography Matrix!
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Rotation from Homography Matrix!
⎛ h1 ⎞
⎜ ⎟ r!1
r!1 = ⎜ h4 ⎟ , r =
r!1 2
1
⎜ −h7 ⎟
⎝ ⎠
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Rotation from Homography Matrix!
⎛ h2 ⎞ ⎛ ⎛ h2 ⎞⎞
⎜ ⎟ ⎜ ⎜ ⎟⎟ r!2
r!2 = ⎜ h5 ⎟ − ⎜ r1 i ⎜ h5 r
⎟⎟ 1 , r =
r!2 2
2
⎜ −h8 ⎟ ⎜ ⎜ −h8 ⎟⎟
⎝ ⎠ ⎝ ⎝ ⎠⎠
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Rotation from Homography Matrix!
⎛ 1 0 0 ⎞ ⎛ r11 r12 tx ⎞ ⎛ h1 h2 h3 ⎞
⎜ 0 1 0 ⎟ ⋅ ⎜ r21 r22
⎟ ⎜
t y ⎟ = s ⎜ h4 h5
⎟
h6 ⎟
⎜ ⎟ ⎜
⎝ 0 0 −1 ⎠ ⎜⎝ r31 r32 t z ⎟⎠ ⎜ h7
⎝ h8 1 ⎟⎠
Get Rotation from Homography Matrix!
⎛ r11 r12 r13 ⎞
⎜ ⎟
• make 3x3 rotation matrix! R = ( r1 r2 r3 ) = ⎜ r21 r22 r23 ⎟
⎜ r31 r32 r33 ⎟⎠
⎝
(θ ,θ ,θ ,t ,t ,t ) ( ) ( )
( k−1) (k)
+ (1− α ) θ x ,θ y ,θ z ,t x ,t y ,t z
(k )
x y z x y z = α θ x ,θ y ,θ z ,t x ,t y ,t z
filtered filtered unfiltered