source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/zisserman/vgg_multiview/vgg_T_from_P.m @ 37

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

Added original make3d

  • Property svn:executable set to *
File size: 1010 bytes
Line 
1% T = vgg_T_from_P(P)  Trifocal tensor from 3 camera matrices.
2%
3% P ... cell (3), camera matrices
4% T ... double (3,3,3)
5%
6% For 3 corresponding lines l1..l3 (each of size (1,3)) in cameras P1..P3 it is
7%         for i=1:3, l1(1,i) = l2*T(:,:,i)*l3'; end
8% up to scale.
9%
10% T is obtained by with unique absolute scale. In detail, for any cameras P{1:3} and
11% scene line L (4-by-4 Pluecker matrix, L+L'=0, vgg_contreps(L)*L=0), if
12%
13%   for i=1:3, l{i} = vgg_contreps(P{i}*L*P{i}'); end
14%   T = vgg_T_from_P(P);
15%   for i=1:3, l1(1,i) = l{2}*T(:,:,i)*l{3}'; end
16%
17% then
18%
19%   l1 ==  l{1}*(l{3}*e32) == -l{1}*(l{2}*e23)
20%
21% where e32 = P{3}*vgg_C_from_P(P{2}), e23 = P{2}*vgg_C_from_P(P{3}) are epipoles.
22
23function T = vgg_T_from_P(P)
24
25T(:,:,1) = P{2}*vgg_contreps(P{1}(2,:)'*P{1}(3,:)-P{1}(3,:)'*P{1}(2,:))*P{3}';
26T(:,:,2) = P{2}*vgg_contreps(P{1}(3,:)'*P{1}(1,:)-P{1}(1,:)'*P{1}(3,:))*P{3}';
27T(:,:,3) = P{2}*vgg_contreps(P{1}(1,:)'*P{1}(2,:)-P{1}(2,:)'*P{1}(1,:))*P{3}';
28
29return
Note: See TracBrowser for help on using the repository browser.