Skip to content

Commit 0304992

Browse files
Add comment about initial guess in undistortion
For the equidistant fisheye model, r/f = tan(theta), the Gauss-Newton search to model radial distortion is expected to converge faster by mapping the angular coordinate space into the respective tangent space of the perspective plane. This is consistent to the nPlaneToSpace initial projection used in the calibrate() function of the omnidirectional model (Cal3Unified).
1 parent 66af007 commit 0304992

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gtsam/geometry/Cal3Fisheye.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,20 @@ Point2 Cal3Fisheye::uncalibrate(const Point2& p, OptionalJacobian<2, 9> H1,
106106
/* ************************************************************************* */
107107
Point2 Cal3Fisheye::calibrate(const Point2& uv, OptionalJacobian<2, 9> Dcal,
108108
OptionalJacobian<2, 2> Dp) const {
109-
// initial gues just inverts the pinhole model
109+
// Apply inverse camera matrix to map the pixel coordinate (u, v)
110+
// of the equidistant fisheye image to angular coordinate space (xd, yd)
111+
// with radius theta given in radians.
110112
const double u = uv.x(), v = uv.y();
111113
const double yd = (v - v0_) / fy_;
112114
const double xd = (u - s_ * yd - u0_) / fx_;
113115
const double theta = sqrt(xd * xd + yd * yd);
114-
const double scale = (theta > 0) ? tan(theta) / theta;
116+
117+
// Provide initial guess for the Gauss-Newton search.
118+
// The angular coordinates given by (xd, yd) are mapped back to
119+
// the focal plane of the perspective undistorted projection pi.
120+
// See Cal3Unified.calibrate() using the same pattern for the
121+
// undistortion of omnidirectional fisheye projection.
122+
const double scale = (theta > 0) ? tan(theta) / theta : 1.0;
115123
Point2 pi(scale * xd, scale * yd);
116124

117125
// Perform newtons method, break when solution converges past tol_,

0 commit comments

Comments
 (0)