source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/MultiCamSelfCal/Ransac/u2F.m @ 37

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

Added original make3d

File size: 707 bytes
Line 
1%u2F    estimates fundamental matrix using ortogonal LS regression
2%       F = u2F(u) estimates F from u using NORMU
3%  F = u2F(u,'nonorm') disables normalization
4%       see also NORMU, U2FA
5
6
7function F = u2F (u, str)
8
9if (nargin > 1) & strcmp(str, 'nonorm')
10   donorm = 0;
11else
12   donorm = 1;
13end
14
15ptNum = size(u,2);
16
17if donorm
18   A1    = normu(u(1:3,:));
19   A2    = normu(u(4:6,:));
20   
21   u1   = A1*u(1:3,:);
22   u2   = A2*u(4:6,:);
23end
24
25for i = 1:ptNum
26   Z(i,:)   = reshape(u1(:,i)*u2(:,i)',1,9);
27end
28
29M       = Z'*Z;
30V       = seig(M);
31F = reshape(V(:,1),3,3);
32
33[uu,us,uv] = svd(F);
34[y,i]      = min (abs(diag(us))); 
35us(i,i)    = 0;
36F          = uu*us*uv';
37
38if donorm
39   F = A1'*F*A2;
40end
41
42F = F /norm(F,2);
Note: See TracBrowser for help on using the repository browser.