undistortion parameters
Hello RC community,
for research purpose, I’m trying to import RC calibration results into other (Open Source) SfM package and I need to do this in both direction (import RC results into other software package and import other software package oriented images into RC) so I can’t afford working with undistorted image.
I know there is a lot of other topic in the forum about this but even after reading them carefully I can’t manage to make this work and I’m pretty confident that it is because I misinterpret how RC applies distortion coefficients and maybe someone could kindly help me to figure that out.
Let say I export things into XMP format
I basically try to project 3d points into oriented/calibrated images
I use a classic formula like this point2d = K * disto( depthNormalized(P*point3d) )
where
 point2d is the projected 2d point in image (in pixel coordinate)
 point3d is my point in world space
 P is my projection matrix established from R and t
 depthNormalized is a function that normalize a 3d point by its third component i.e. (x/z, x/z, 1) = depthNormalized((x,y,z))
 let say I use a brown3 disto model, I get the 5 coef (k1,k2,k3,t1,t2) from the corresponding tag into XMP
my disto function works like this
r2 = x * x + y * y
r4 = r2 * r2
r6 = r4 * r2
radial_part = 1.0 + k1 * r2 + k2 * r4 + k3
tangential_x = t2 * (r2 + 2.0 * x * x) + 2.0 * t1 * x * y
tangential_y = t1 * (r2 + 2.0 * y * y) + 2.0 * t2 * x * y
return (x * radial_part + tangential_x, y * radial_part + tangential_y, z)
 I construct my 3x3 K matrix as follow
[f s cx]
[0 f*a cy]
[0 0 1]
where :
f is in pixel unit and computed from FocalLength35mm attribute from xmp file as follow f = max(image_width, image_height) * (FocalLength35mm / 36)
s is the skew factor straight from Skew attribute from xmp file
a is the aspect ratio factor from AspectRatio attribute
cx and cy are in pixel units and for exemple cx is computed as follow cx = image_witdh / 2 + image_width * PrincipalPointU where PrincipalPointU come from the corresponding tag in the XMP file
my projection is ok in the center of image but is few pixels off near the border, so I wonder if it’s not an issue with the way I apply my distortion parameters…
as a side note it's not a precison issue beacuse the reprojection is perfect with undistorted images.
Does any one could give my any pointer on that ?
Thanks !

Hello Romain,
from what I can see in the “radial_part” there is a missing r6 at the end of the formula:
radial_part = 1.0 + k1 * r2 + k2 * r4 + k3*r6Also, for the tangential part, we use the definition from wiki:
https://en.wikipedia.org/wiki/Distortion_(optics)
in which the t1 and t2 are switched. From my understanding, e.g. open CV uses tangential coefficients in reverse order.
The formula that we use is as follows:

Hello Zuzana,
the lack of r6 was an error due to copying and pasting to the forum, sorry for that misleading cue...
But I tested with "inverted" (in fact in the right order) tangential coef like in your formula (and unlike openCV) and it works!
thanks a lot for your quick and kind answer!
Please sign in to leave a comment.
Comments
3 comments