Line | |
---|
1 | %normu Normalize image points to be used for LS estimation. |
---|
2 | % A = normu(u) finds normalization matrix A so that mean(A*u)=0 and |
---|
3 | % mean(||A*u||)=sqrt(2). (see Hartley: In Defence of 8-point Algorithm, |
---|
4 | % ICCV`95). |
---|
5 | % |
---|
6 | % Parameters: |
---|
7 | % u ... Size (2,N) or (3,N). Points to normalize. |
---|
8 | % A ... Size (3,3). Normalization matrix. |
---|
9 | |
---|
10 | function A = normu(u) |
---|
11 | |
---|
12 | if size(u,1)==3, u = p2e(u); end |
---|
13 | |
---|
14 | m = mean(u')'; % <=> mean (u,2) |
---|
15 | u = u - m*ones(1,size(u,2)); |
---|
16 | distu = sqrt(sum(u.*u)); |
---|
17 | r = mean(distu)/sqrt(2); |
---|
18 | if ~r, A = []; return; end % one of degenarate configurations |
---|
19 | A = diag([1/r 1/r 1]); |
---|
20 | A(1:2,3) = -m/r; |
---|
Note: See
TracBrowser
for help on using the repository browser.