Calibration and Image Rotation
Rotating Points
To stay consistent with the OpenCV camera coordinate frame, we put the origin in the top left, with X right, Y down, and Z out (as required by the right-hand rule). Intuitively though, if I ask you to rotate an image 90 degrees clockwise though, you’d probably rotate it about -Z in this coordinate system. Just be aware of this inconsistency.
If we have any one point in any of those coordinate systems, we can transform it into any of the other ones using standard geometry libraries by performing relative transformations (like in this pseudocode):
Translation2d tag_corner1 = new Translation2d();
Translation2d rotated = tag_corner1.relativeTo(ORIGIN_ROTATED_90_CCW);
Image Distortion
The distortion coefficients for OPENCV8 is given in order [k1 k2 p1 p2 k3 k4 k5 k6]
. Mrcal names these coefficients [k_0 k_1, k_2, k_3, k_4, k_5, k_6, k_7]
.
From this, we observe at k_0, k_1, k_4, k_5, k_6, k_7
depend only on the norm of \(\vec P\), and will be constant given a rotated image. However, k_2
and k_3
go with \(P_0 \cdot P_1\), k_3
with \(P_0^2\), and k_2
with \(P_1^2\).
Let’s try a concrete example. With a 90 degree CCW rotation, we have \(P0=-P_{1\mathrm{rotated}}\) and \(P1=P_{0\mathrm{rotated}}\). Let’s substitute in
By inspection, this results in just applying another 90 degree rotation to the k2/k3 parameters. Proof is left as an exercise for the reader. Note that we can repeat this rotation to yield equations for tangential distortion for 180 and 270 degrees.