source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/RadialDistortions/isptnorm.m @ 37

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

Added original make3d

File size: 707 bytes
Line 
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
12function [xnorm,T] = isptnorm(x);
13
14
15% data dimension
16dim = size(x,2);
17N       = size(x,1);
18
19% make homogenous coordinates
20x(:,dim+1) = ones(N,1);
21
22% compute sum of square diferences
23for i=1:dim,
24        ssd(:,i) = (x(:,i)-mean(x(:,i))).^2;
25end
26
27scale = (sqrt(dim)*N) / (sum(sqrt(sum(ssd'))));
28
29T = zeros(dim+1);
30
31for i=1:dim,
32        T(i,i)     = scale;
33        T(i,dim+1) = -scale*mean(x(:,i));
34end
35T(dim+1,dim+1) = 1;
36
37xnorm = T*x';
38xnorm = xnorm';
39% return nonhomogenous part of the points coordinates
40xnorm = xnorm(:,1:dim);
41
42
43
Note: See TracBrowser for help on using the repository browser.