Rev | Line | |
---|
[37] | 1 | function [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 | |
---|
| 7 | trans = -(sum(M'))/size(M,2); |
---|
| 8 | transmat = repeat(trans',size(M,2)); |
---|
| 9 | M3 = M + transmat; |
---|
| 10 | |
---|
| 11 | [u,s,v] = svd(M3); |
---|
| 12 | vp = v'; |
---|
| 13 | u3 = u(:,1:3); |
---|
| 14 | s3 = s(1:3,1:3); |
---|
| 15 | s3sqrt = sqrt(s3); |
---|
| 16 | vp3 = vp(1:3,:); |
---|
| 17 | |
---|
| 18 | T = [u3*s3sqrt,-trans']; |
---|
| 19 | P = [s3sqrt*vp3; ones(1,size(M,2))]; |
---|
| 20 | |
---|
Note: See
TracBrowser
for help on using the repository browser.