[Bf-committers] Movie distortion algorithm
Jeroen Bakker
j.bakker at atmind.nl
Mon Apr 16 09:19:52 CEST 2012
Hi all!
last week Sergey and I had a discussion about the Movie (un)distortion
algorithm in tracking/libmv.
The undistortion algorithm is a the same as described in
http://en.wikipedia.org/wiki/Distortion_%28optics%29
but when distorting a video-clip a solver is used to determine the
inverse of this algorithm what is slow.
Is there any mathemagician who can help out to find the inverse of this
algorithm.
in code the algorithm is located in libmv/camera_intrinsics.cc
void CameraIntrinsics::ApplyIntrinsics(double normalized_x,
double normalized_y,
double *image_x,
double *image_y) const {
double x = normalized_x;
double y = normalized_y;
// Apply distortion to the normalized points to get (xd, yd).
double r2 = x*x + y*y;
double r4 = r2 * r2;
double r6 = r4 * r2;
double r_coeff = (1 + k1_*r2 + k2_*r4 + k3_*r6);
double xd = x * r_coeff + 2*p1_*x*y + p2_*(r2 + 2*x*x);
double yd = y * r_coeff + 2*p2_*x*y + p1_*(r2 + 2*y*y);
// Apply focal length and principal point to get the final image
coordinates.
*image_x = focal_length_x() * xd + principal_point_x();
*image_y = focal_length_y() * yd + principal_point_y();
}
Regards,
Jeroen Bakker
More information about the Bf-committers
mailing list