source: trunk/src/toolbox_calib/normalize_pixel.m @ 945

Last change on this file since 945 was 926, checked in by sommeria, 8 years ago

geometry cqlib updated

File size: 1.1 KB
Line 
1function [xn] = normalize_pixel(x_kk,fc,cc,kc,alpha_c)
2
3%normalize
4%
5%[xn] = normalize_pixel(x_kk,fc,cc,kc,alpha_c)
6%
7%Computes the normalized coordinates xn given the pixel coordinates x_kk
8%and the intrinsic camera parameters fc, cc and kc.
9%
10%INPUT: x_kk: Feature locations on the images
11%       fc: Camera focal length
12%       cc: Principal point coordinates
13%       kc: Distortion coefficients
14%       alpha_c: Skew coefficient
15%
16%OUTPUT: xn: Normalized feature locations on the image plane (a 2XN matrix)
17%
18%Important functions called within that program:
19%
20%comp_distortion_oulu: undistort pixel coordinates.
21
22if nargin < 5,
23   alpha_c = 0;
24   if nargin < 4;
25      kc = [0;0;0;0;0];
26      if nargin < 3;
27         cc = [0;0];
28         if nargin < 2,
29            fc = [1;1];
30         end;
31      end;
32   end;
33end;
34
35
36% First: Subtract principal point, and divide by the focal length:
37x_distort = [(x_kk(1,:) - cc(1))/fc(1);(x_kk(2,:) - cc(2))/fc(2)];
38
39% Second: undo skew
40x_distort(1,:) = x_distort(1,:) - alpha_c * x_distort(2,:);
41
42if norm(kc) ~= 0,
43        % Third: Compensate for lens distortion:
44        xn = comp_distortion_oulu(x_distort,kc);
45else
46   xn = x_distort;
47end;
Note: See TracBrowser for help on using the repository browser.