Rev | Line | |
---|
[725] | 1 | function [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 |
|
---|
| 22 | if 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;
|
---|
| 33 | end;
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | % First: Subtract principal point, and divide by the focal length:
|
---|
| 37 | x_distort = [(x_kk(1,:) - cc(1))/fc(1);(x_kk(2,:) - cc(2))/fc(2)];
|
---|
| 38 |
|
---|
| 39 | % Second: undo skew
|
---|
| 40 | x_distort(1,:) = x_distort(1,:) - alpha_c * x_distort(2,:);
|
---|
| 41 |
|
---|
| 42 | if norm(kc) ~= 0,
|
---|
| 43 | % Third: Compensate for lens distortion:
|
---|
| 44 | xn = comp_distortion_oulu(x_distort,kc);
|
---|
| 45 | else
|
---|
| 46 | xn = x_distort;
|
---|
| 47 | end;
|
---|
Note: See
TracBrowser
for help on using the repository browser.