def tensor(a,b):
'''Returns the 3x3x3 (27 element) trifocal tensor given two 3x4 camera matrices.
'''
T = zeros((3,3,3))
for i in range(3):
T[i] = outer(a[:,i],b[:,3]) - outer(a[:,3],b[:,i])
return T
# OR, given A and B 3x4 arrays
T = array([(outer(a[:,i],b[:,3]) - outer(a[:,3],b[:,i])) for i in range(3)])
Diff to Previous Revision
--- revision 3 2012-06-27 03:32:05
+++ revision 4 2012-06-27 03:38:35
@@ -5,3 +5,7 @@
for i in range(3):
T[i] = outer(a[:,i],b[:,3]) - outer(a[:,3],b[:,i])
return T
+
+# OR, given A and B 3x4 arrays
+
+T = array([(outer(a[:,i],b[:,3]) - outer(a[:,3],b[:,i])) for i in range(3)])