source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/tk_affine.m @ 37

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

Added original make3d

File size: 564 bytes
Line 
1function [T, P] = tk_affine(M)
2% This basically reimplements the Tomasi and Kanade algorithm for the case
3% of affine motion, including allowing for translation.  We return the
4% motion matrix, with translation in the fourth column, and the pts, with
5% the 4th row = (1,1,1 ... 1,1).  The estimated matrix is T*P.
6
7trans = -(sum(M'))/size(M,2);
8transmat = repeat(trans',size(M,2));
9M3 = M + transmat;
10
11[u,s,v] = svd(M3);
12vp = v';
13u3 = u(:,1:3);
14s3 = s(1:3,1:3);
15s3sqrt = sqrt(s3);
16vp3 = vp(1:3,:);
17
18T = [u3*s3sqrt,-trans'];
19P = [s3sqrt*vp3; ones(1,size(M,2))];
20
Note: See TracBrowser for help on using the repository browser.