Rev | Line | |
---|
[37] | 1 | % undoradial remove radial distortion
|
---|
| 2 | %
|
---|
| 3 | % [xl] = undoradial(x,K,kc)
|
---|
| 4 | %
|
---|
| 5 | % x ... 3xN coordinates of the distorted pixel points
|
---|
| 6 | % K ... 3x3 camera calibration matrix
|
---|
| 7 | % kc ... 4x1 vector of distortion parameters
|
---|
| 8 | %
|
---|
| 9 | % xl ... linearized pixel coordinates
|
---|
| 10 | % these coordinates should obey the linear pinhole model
|
---|
| 11 | %
|
---|
| 12 | % It calls comp_distortion_oulu: undistort pixel coordinates.
|
---|
| 13 | % function taken from the CalTech camera calibration toolbox
|
---|
| 14 |
|
---|
| 15 | function [xl] = undoradial(x_kk,K,kc)
|
---|
| 16 |
|
---|
| 17 | cc(1) = K(1,3);
|
---|
| 18 | cc(2) = K(2,3);
|
---|
| 19 | fc(1) = K(1,1);
|
---|
| 20 | fc(2) = K(2,2);
|
---|
| 21 |
|
---|
| 22 | % First: Subtract principal point, and divide by the focal length:
|
---|
| 23 | x_distort = [(x_kk(1,:) - cc(1))/fc(1);(x_kk(2,:) - cc(2))/fc(2)];
|
---|
| 24 |
|
---|
| 25 | if norm(kc) ~= 0,
|
---|
| 26 | % Third: Compensate for lens distortion:
|
---|
| 27 | xn = comp_distortion_oulu(x_distort,kc);
|
---|
| 28 | else
|
---|
| 29 | xn = x_distort;
|
---|
| 30 | end;
|
---|
| 31 |
|
---|
| 32 | % back to the linear pixel coordinates
|
---|
| 33 | xl = K*[xn;ones(size(xn(1,:)))];
|
---|
Note: See
TracBrowser
for help on using the repository browser.