Rev | Line | |
---|
[37] | 1 | % isptnorm ISotropic PoinT NORMalization |
---|
| 2 | % |
---|
| 3 | % [xnorm,T] = isptnorm(x); |
---|
| 4 | % x ... [N x dim] coordinates |
---|
| 5 | % |
---|
| 6 | % xnorm ... normalized coordinates |
---|
| 7 | % T ... transformation matrix used |
---|
| 8 | % |
---|
| 9 | % T. Svoboda, 5/2001 |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | function [xnorm,T] = isptnorm(x); |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | % data dimension |
---|
| 16 | dim = size(x,2); |
---|
| 17 | N = size(x,1); |
---|
| 18 | |
---|
| 19 | % make homogenous coordinates |
---|
| 20 | x(:,dim+1) = ones(N,1); |
---|
| 21 | |
---|
| 22 | % compute sum of square diferences |
---|
| 23 | for i=1:dim, |
---|
| 24 | ssd(:,i) = (x(:,i)-mean(x(:,i))).^2; |
---|
| 25 | end |
---|
| 26 | |
---|
| 27 | scale = (sqrt(dim)*N) / (sum(sqrt(sum(ssd')))); |
---|
| 28 | |
---|
| 29 | T = zeros(dim+1); |
---|
| 30 | |
---|
| 31 | for i=1:dim, |
---|
| 32 | T(i,i) = scale; |
---|
| 33 | T(i,dim+1) = -scale*mean(x(:,i)); |
---|
| 34 | end |
---|
| 35 | T(dim+1,dim+1) = 1; |
---|
| 36 | |
---|
| 37 | xnorm = T*x'; |
---|
| 38 | xnorm = xnorm'; |
---|
| 39 | % return nonhomogenous part of the points coordinates |
---|
| 40 | xnorm = xnorm(:,1:dim); |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
Note: See
TracBrowser
for help on using the repository browser.