-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSL3HomParam.py
50 lines (44 loc) · 1.25 KB
/
SL3HomParam.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Paramaterization of the set of homography using the lie algebra sl(3)
associated to the special linear group SL(3). This has the advantage of
only producing homographie matrices with det(H) = 1.
For details, see
S. Benhimane and E. Malis, "Real-time image-based tracking of planes
using efficient second-order minimization," Intelligent Robots and Systems, 2004.
(IROS 2004). Proceedings. 2004 IEEE/RSJ International Conference on, vol. 1,
pp. 943-948 vol. 1, 2004.
Author: Travis Dick (travis.barry.dick@gmail.com)
"""
import numpy as np
from scipy.linalg import expm
_sl3_basis = map(lambda x: np.matrix(x, dtype=np.float64), [
[[0,1,0],
[0,0,0],
[0,0,0]],
[[0,0,1],
[0,0,0],
[0,0,0]],
[[0,0,0],
[0,0,1],
[0,0,0]],
[[0,0,0],
[1,0,0],
[0,0,0]],
[[0,0,0],
[0,0,0],
[1,0,0]],
[[0,0,0],
[0,0,0],
[0,1,0]],
[[1,0,0],
[0,-1,0],
[0,0,0]],
[[0,0,0],
[0,1,0],
[0,0,-1]]]
)
def make_hom_sl3(p):
log = 0
for i in xrange(8):
log += p[i] * _sl3_basis[i]
return np.asmatrix(expm(log))