source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/zisserman/vgg_numerics/vgg_contreps.m @ 86

Last change on this file since 86 was 37, checked in by (none), 15 years ago

Added original make3d

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1function Y = vgg_contreps(X)
2
3% vgg_contreps  Contraction with epsilon tensor.
4%
5% B = vgg_contreps(A) is tensor obtained by contraction of A with epsilon tensor.
6% However, it works only if the argument and result fit to matrices, in particular:
7%
8% - if A is row or column 3-vector ...  B = [A]_x
9% - if A is skew-symmetric 3-by-3 matrix ... B is row 3-vector such that A = [B]_x
10% - if A is skew-symmetric 4-by-4 matrix ... then A can be interpreted as a 3D line Pluecker matrix
11%                                               skew-symmetric 4-by-4 B as its dual Pluecker matrix.
12% - if A is row 2-vector ... B = [0 1; -1 0]*A', i.e., A*B=eye(2)
13% - if A is column 2-vector ... B = A'*[0 1; -1 0], i.e., B*A=eye(2)
14%
15% It is vgg_contreps(vgg_contreps(A)) = A.
16
17% werner@robots.ox.ac.uk, Oct 2001
18
19if prod(size(X)) == 3  % get [X]_\times
20  Y = [0 X(3) -X(2)
21      -X(3) 0 X(1)
22       X(2) -X(1) 0];
23elseif all(size(X) == [1 2])
24  Y = [0 1; -1 0]*X';
25elseif all(size(X) == [2 1])
26  Y = X'*[0 1; -1 0];
27elseif all(size(X) == [3 3]) % get X from [X]_\times
28  Y = [X(2,3) X(3,1) X(1,2)];
29elseif all(size(X) == [4 4])  % pluecker matrix dual
30  Y = [0      X(3,4) X(4,2) X(2,3)
31       X(4,3) 0      X(1,4) X(3,1)
32       X(2,4) X(4,1) 0      X(1,2)
33       X(3,2) X(1,3) X(2,1) 0     ];
34else
35  error('Wrong matrix size.')
36end
Note: See TracBrowser for help on using the repository browser.