source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/RansacM/u2Fdlt.m @ 37

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

Added original make3d

File size: 1.0 KB
Line 
1function F = u2Fdlt(u,do_norm)
2% u2Fdlt      linear estimation of the Fundamental matrix
3%             from point correspondences
4%
5% H = u2Fdlt(u,{do_norm=1})
6% u ... {4|6}xN corresponding coordinates
7% do_norm .. do isotropic normalization of points?
8%
9% F ... 3x3 fundamental matrix
10%
11% $Id: u2Fdlt.m,v 1.1 2005/05/23 16:16:01 svoboda Exp $
12
13NoPoints = size(u,2);
14
15if nargin < 2
16  do_norm=1;
17end
18
19u = u';
20
21% parse the input parameters
22if NoPoints<8
23  error('Too few correspondences')
24end
25
26if size(u,2) == 4,
27  % make the homogenous coordinates
28  u = [u(:,1:2), ones(size(u(:,1))), u(:,3:4), ones(size(u(:,1)))];
29end
30
31u1 = u(:,1:3);
32u2 = u(:,4:6);
33
34if do_norm
35  [u1,T1] = pointnormiso(u1');
36  u1 = u1';
37  [u2,T2] = pointnormiso(u2');
38  u2 = u2';
39end
40
41% create the data matrix
42A = zeros(NoPoints,9);
43for i=1:NoPoints                             % create equations
44 for j=1:3
45  for k=1:3
46   A(i,(j-1)*3+k)=u2(i,j)*u1(i,k);   
47  end
48 end
49end
50
51[U,S,V]  = svd(A);
52f        = V(:,size(V,2));
53F        = reshape(f,3,3)';
54
55if do_norm
56  F = inv(T2)*F*T1;
57end
58
59return;
Note: See TracBrowser for help on using the repository browser.