source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_quick_fit.m @ 37

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

Added original make3d

File size: 795 bytes
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3%makes a super quick fit (Torr trick of the trade...)
4%example given two points we can determine a quick fit to a line as
5
6
7% det [i  j  k ]
8%     [x  y  m3]
9%     [x' y' m3]
10%     
11%     where the coefficients of i,j,k are the coefficients of the line
12
13%this result generalizes to any dimension allowing for quick fitting of minimal sets without SVD.
14
15%for Matlab there is no gain over SVD, but there might be for C++
16
17
18function result = torr_quick_fit(M)
19
20
21nc = length(M);
22normM = norm(M);
23
24% if (nr ~= nc-1)
25%     error('wrong matrix size in torr_quick_fit');
26% end
27
28for i = 1:nc
29    A = M(:, [1:i-1 i+1:nc])/normM;
30    result(i) = (-1)^(i+1) * det(A);
31end
32
33
34result = result'/norm(result);
35   
36   
37   
Note: See TracBrowser for help on using the repository browser.