58 float R = sqrtf(x_n*x_n + y_n*y_n);
59 float r = tanf( asinf( (1.0f / k) * sinf( atanf( R ) ) ) );
60 float reduction_factor = r/R;
61 (*x_nd) = reduction_factor * x_n;
62 (*y_nd) = reduction_factor * y_n;
77 float r = sqrtf( x_nd*x_nd + y_nd*y_nd );
78 float inner_part = sinf( atanf( r ) ) * k;
80 if(fabs(inner_part) > 0.9999) {
84 float R = tanf( asinf( inner_part ) );
85 float enlargement_factor = R / r;
86 (*x_n) = enlargement_factor * x_nd;
87 (*y_n) = enlargement_factor * y_nd;
101 (*x_p) = x_n_ *
K[0] +
K[2];
102 (*y_p) = y_n_ *
K[4] +
K[5];
114 (*x_n_) = (x_p -
K[2]) /
K[0];
115 (*y_n_) = (y_p -
K[5]) /
K[4];
bool distorted_pixels_to_normalized_coords(float x_pd, float y_pd, float *x_n, float *y_n, float k, const float *K)
Transform distorted pixel coordinates to normalized coordinates.
void normalized_to_pixels(float x_n_, float y_n_, float *x_p, float *y_p, const float *K)
Transform normalized coordinates to pixel coordinates.
bool Dhane_undistortion(float x_nd, float y_nd, float *x_n, float *y_n, float k)
Undistort distorted normalized image coordinates with the invertible Dhane method.
bool normalized_coords_to_distorted_pixels(float x_n, float y_n, float *x_pd, float *y_pd, float k, const float *K)
Transform normalized coordinates to distorted pixel coordinates.
bool Dhane_distortion(float x_n, float y_n, float *x_nd, float *y_nd, float k)
Distort normalized image coordinates with the invertible Dhane method.
void pixels_to_normalized(float x_p, float y_p, float *x_n_, float *y_n_, const float *K)
Transform pixel coordinates to normalized coordinates.
Functions for undistorting camera images.