source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/zisserman/vgg_numerics/vgg_diagonalize_conic.m @ 37

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

Added original make3d

  • Property svn:executable set to *
File size: 619 bytes
Line 
1% H = vgg_diagonalize_conic(C)  Finds Euclidean transformation sending conic canonical position.
2%
3% For any symmetric matrix C, returns Euclidean transformation H such that
4%    H'*C*H
5% is a diagonal matrix.
6%
7% Typical usage is to transform conics to canonical form, to classify or plot them.
8
9function H = vgg_diagonalize_conic(C)
10
11N = size(C,1);
12
13C = C/C(end,end);
14s = C(1:end-1,end);
15Q = C(1:end-1,1:end-1);
16
17[U,S,V] = svd(Q);
18sw = diag([-1 ones(1,N-2)]);
19if det(U) < 0
20  U = U*sw;
21  S = sw*S;
22end
23if det(V) < 0
24  V = V*sw;
25  S = S*sw;
26end
27
28H = [U -inv(Q)*s; zeros(1,N-1) 1];
29
30return
Note: See TracBrowser for help on using the repository browser.