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

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

Added original make3d

File size: 917 bytes
Line 
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
15function [xl] = undoradial(x_kk,K,kc)
16
17cc(1) = K(1,3);
18cc(2) = K(2,3);
19fc(1) = K(1,1);
20fc(2) = K(2,2);
21
22% First: Subtract principal point, and divide by the focal length:
23x_distort = [(x_kk(1,:) - cc(1))/fc(1);(x_kk(2,:) - cc(2))/fc(2)];
24
25if norm(kc) ~= 0,
26        % Third: Compensate for lens distortion:
27        xn = comp_distortion_oulu(x_distort,kc);
28else
29   xn = x_distort;
30end;
31
32% back to the linear pixel coordinates
33xl = K*[xn;ones(size(xn(1,:)))];
Note: See TracBrowser for help on using the repository browser.