2.1. Global Camera Model with B-Spline Distortion
We employ Zhang’s calibration method [
7] for initialization. By capturing multiple images of a planar calibration pattern from various orientations, we first estimate the initial camera parameters while neglecting lens distortion. These parameters include the intrinsic matrix
K (comprising focal lengths
,
, principal point coordinates
,
, and skew coefficient
s), as well as the extrinsic parameters (rotation matrix
R and translation vector
t) for each image.
The complete projection process, which maps a 3D world point to its corresponding 2D image coordinates while accounting for lens distortion, is formulated as follows. This pipeline defines the functional relationship between the estimated parameters and the final reprojection error.
The world point
is first transformed into the camera coordinate system using the extrinsic parameters:
The point
is then further projected onto the normalized image plane via standard perspective division:
These normalized coordinates are subsequently converted into ideal (undistorted) pixel coordinates using the intrinsic camera parameters:
Based on these estimated parameters, the world coordinates of the calibration pattern corners are projected to obtain their ideal pixel coordinates. The discrepancy between these coordinates and the observed pixel coordinates defines the observed distortion field:
where
denotes the distortion vector, and
,
represent the distortion offsets along the horizontal and vertical image axes, respectively.
To model this distortion field using a bicubic B-spline surface, the undistorted pixel coordinates are first normalized to the domain
using the image dimensions:
where
and
represent the image width and height, respectively. This normalization establishes a unified reference frame essential for the B-spline formulation.
The lens distortion offsets at normalized image coordinates are then modeled using bicubic B-spline surfaces:
where
and
represent the control point grids for each distortion component;
and
are the
p-th and
q-th degree B-spline basis functions; and
i,
j index the control points.
The final, distorted pixel coordinates
are obtained by adding the computed distortion offsets to the undistorted pixel coordinates:
The residual vector
r for a single observed image point
is thus defined as the difference between the projected-distorted coordinates and the observation:
This residual depends on all parameters involved in the pipeline: the extrinsic parameters (R, t), the intrinsic parameters (), and the distortion parameters (the control point values ). The primary objective of this work is to accurately model the distortion vector field using this bicubic B-spline formulation.
2.2. Jacobian and Numerical Stability Analysis
In the previous section, a unified camera calibration framework is established using B-spline modeling. Since the behavior of B-spline fitting inherently depends on data distribution characteristics, integrating the distortion model into a comprehensive optimization framework and examining its numerical properties becomes necessary. Accordingly, this section analyzes the Jacobian matrix arising in the nonlinear optimization process and further investigates the essential stability conditions to guarantee convergence and well-posedness.
2.2.1. Jacobian Matrix Derivation
The Jacobian block for intrinsic parameters
is:
where
, and
.
The stability conditions include three aspects. First, normalized coordinates must be non-zero, meaning and . Second, distortion derivatives must satisfy the validity conditions, specifically and . Finally, the data points must be well distributed to ensure the linear independence of the column vectors.
The Jacobian blocks for control points are:
The stability conditions include four aspects. First, each control point has valid observations with . Second, observations must cover the full parameter space. Third, the basis functions remain linearly independent. Fourth, reasonable density requires the spacing of the control points to match the complexity of the distortion.
The camera pose (extrinsic parameters) is represented using Lie algebra
, where
is the rotation vector and
is the translation vector. A 3D world point
is transformed to the camera coordinate frame via the exponential map:
where
denotes wedge operator mapping the 6D vector
to a
antisymmetric matrix.
The Jacobian of the reprojection error with respect to the camera pose parameters is derived using the chain rule. Starting with the normalized image coordinates:
where
is the skew-symmetric matrix form of
:
The derivatives for undistorted pixel coordinates incorporate the focal lengths:
The Jacobian of the reprojection error with respect to the Lie algebra parameters is:
where the coefficients account for distortion effects:
The stability conditions consist of the following six aspects. First, non-zero depth requires to avoid singularities in the derivatives. Second, valid image dimensions require and to prevent division by zero. Third, non-zero focal lengths require and to ensure a valid transformation. Fourth, non-degenerate points require to ensure valid coordinate transformations. Fifth, an active distortion model requires non-zero B-spline derivatives and control points. Sixth, a full-rank coupling matrix requires to maintain invertibility.
The distortion derivatives and play a critical role in the Jacobian analysis. These derivatives are fundamentally governed by the control point grids and through the corresponding derivatives of the B-spline basis functions. Consequently, the control points emerge as the cornerstone parameters that dictate both the distortion characteristics and the numerical stability of the overall calibration framework.
2.2.2. Stability Conditions for B-Spline Modeling
As established by the Jacobian matrix analysis, preventing zero columns and maintaining full column rank requires that the data distribution ensures non-trivial B-spline distortion derivatives and control point activations. This subsection further examines the specific numerical stability conditions governing the B-spline formulation.
- (1)
Basis functions
The B-spline basis functions are piecewise polynomial functions defined over a set of non-decreasing real numbers known as the knot vector. For example, the knot vector in the
u-direction is given by
. The basis function
in the
u-direction is defined as follows: When
(zeroth-degree basis function):
When
(
p-th degree basis function):
where
p represents the degree of the basis function, and
i represents the index of the basis function. Each basis function can be expressed as a cubic polynomial in the form:
where the coefficients
depend on the nodal spacings
.
When the nodes are located at the boundary endpoints, the basis functions satisfy the following vanishing property at the nodes:
Each basis function comprises multiple rational components whose denominators contain products of non-uniform nodal spacings . Partial derivatives demonstrate considerable non-trivial properties.
The partial derivatives of the displacement functions with respect to the parametric coordinates can be derived from Equations (
6) and (
7):
These derivative expressions can be further expanded by incorporating the polynomial representation of the basis functions. For the cubic case where
and
, we substitute the polynomial form:
where
and
are the polynomial coefficients for the basis functions
and
respectively, and the polynomial representation.
From the above formulation, it is evident that the existence and magnitude of the non-trivial B-spline distortion derivatives are governed by the properties of the basis function matrix and, more fundamentally, are immediately influenced by the data distribution.
- (2)
Matrix Representation of B-Spline Basis Functions
Assume the number of node vectors is , denoted as . Let the order be p, and the number of control points be . Then, the relationship holds. A data point is selected within each node interval, resulting in the set , where each lies in the interval .
Basis function matrix structure for
with Non-Repeating End Nodes is as follows:
The structure of the basis function matrix for
with repeated end nodes is given as follows:
The use of repeated end nodes enhances the control over data points near the boundaries. As shown in Equations (
27) and (
28), when end nodes are repeated, the first data point
influences four control points. In contrast, with non-repeating end nodes,
influences only one control point. If few data points are located near the boundaries, the influence of boundary data on the control points is reduced, causing the control points to be predominantly determined by interior data. This can lead to surface distortion when solving for the control points. Therefore, it is necessary to repeat the end nodes when constructing the node vector.
- (3)
Full Column Rank Condition of the Basis Function Matrix
The local support property of B-spline basis functions requires that the observation domain of each control point contains sufficient sampling points to ensure basis activation. In the proposed calibration framework, the observation matrix exhibits a strictly banded structure, where each row contains only non-zero elements. If a knot span lacks sufficient data points, a zero column will appear in . This breaks the banded continuity and leads to column-rank deficiency, preventing a unique numerical solution for the control points .
Notably, the use of repeated end knots (clamped knots) significantly increases the sensitivity of the system to the boundary data distribution.As shown in Equation (
28), repeated knots cause the support of boundary basis functions to be highly concentrated. If the initial interval
lacks a key observation
, the first column of the matrix becomes a zero vector, causing the boundary control points to become unconstrained. Unlike interior spans with smooth transitions, boundary spans carry critical geometric information that constrains the extrapolation behavior of the spline surface. Therefore, to ensure a full-rank matrix and suppress numerical oscillations, observations must fully cover the parameter space defined by the knot vector. Specifically, each knot span must contain at least one valid observation, especially in boundary regions where basis functions decay rapidly, to avoid system singularity or non-physical surface distortion.
2.3. Adaptive Knot Generation Based on Distortion-Weighted KDE
According to the analysis in the previous section, stable control-point estimation requires sufficient activation and coverage of the B-spline basis over the observation domain. In calibration with freeform lenses, however, checkerboard corners are only available at scattered and viewpoint-dependent image locations. As a result, uniformly distributed knots may create intervals with weak support or even empty tensor-product cells, which degrades the conditioning of the basis matrix and reduces estimation stability.
To address this issue, we construct the knot vectors adaptively based on the observed global corner distribution and local variations in the distortion response. Let denote the normalized image coordinates of the ith corner, and let denote the corresponding distortion response ( or ). The core idea is to construct a weight function using local variations of the discrete samples and to introduce weighted kernel density estimation to guide knot placement. The detailed algorithm is as follows.
- (1)
Discrete Estimation of the Weighting Term
For each direction
, the samples are sorted according to that coordinate. Let
denote the reordered sequence, where
is either
or
. Rather than interpolating a dense distortion surface and differentiating it, we estimate local distortion variation directly from the discrete samples by a sliding-window statistic. The window size is defined as:
where
is the window ratio and
is the minimum admissible window size. The odd-valued form ensures a symmetric neighborhood. For the
k-th sorted sample, the local index set is:
Local distortion variation along direction
d is then given by sample standard deviation:
The quantity
serves as a discrete proxy for the local distortion-gradient magnitude: it becomes large when the response varies rapidly within a local neighborhood and small in smooth regions. Therefore, Equation (
29) is implemented in practice by replacing the ideal continuous gradient magnitude with the above discrete local-variation estimate.
To avoid excessive dominance by a few isolated samples, the variation values are linearly normalized into a bounded interval:
where
and
.
We set and . This range is chosen to balance model adaptability and structural stability. Specifically, the upper limit allows regions with complex distortion to increase their local knot density by up to 50% to capture fine details, while the lower limit ensures that smooth regions retain at least half of the baseline density. This lower bound prevents the grid from becoming overly sparse, which could lead to rank deficiency during the optimization process. Consequently, this strategy adaptively allocates knots based on the degree of distortion while guaranteeing the numerical robustness of the global optimization.
- (2)
Weighted KDE along the Two Image Directions
Given the directional weights, one-dimensional weighted KDE is performed separately along the
u- and
v-axes:
where
is the Gaussian kernel and
where
denotes the normalized weight in direction
d.
The bandwidth along each direction
is selected by Scott’s rule under weighted sampling:
where
is the standard deviation of the samples along direction
d. The effective sample size
is given by
This formulation preserves the standard Scott scaling while accounting for unequal sample influence. In practice, it provides a stable compromise between oversmoothing and spurious local oscillations.
- (3)
Adaptive Knot Generation and Grid Optimization
To balance model compactness and fitting accuracy, we propose a three-stage knot placement strategy based on the evaluated weighted KDE curves: initial knot generation, 1D interval merging, and 2D coverage optimization.
First, candidate knots are initialized from three sources: the normalized domain boundaries (0 and 1); the local maxima of and (to capture dense informative samples); and the empirical quartiles (25%, 50%, and 75%) to ensure global spatial coverage. These candidates are then deduplicated and sorted to form the initial 1D knot vectors.
Second, support-aware interval merging is applied to satisfy the full-rank requirement for control point estimation. For a knot vector
in direction
, the support count
of the
r-th interval is defined as:
where the last interval includes its right endpoint, and
denotes the set cardinality. Let
be the minimum data threshold, where
is the number of valid corners. If
, an interior knot is removed to merge the interval with an adjacent one. To limit model complexity, each dimension is capped at 15 intervals. Intervals with the fewest observations are iteratively merged until these 1D constraints are satisfied, explicitly enforcing the coverage requirement analyzed in previous section.
Finally, 2D coverage optimization is performed. Even if both 1D knot vectors meet the support criteria, the resulting tensor-product grid may still contain empty 2D cells, causing inactive basis functions in the final bicubic B-spline surface. To resolve this, we compute a 2D occupancy histogram:
If empty cells () exist, the algorithm identifies the dimension with the highest number of empty cells and prioritizes interval merging along that dimension. This cross-dimensional refinement iterates (up to 30 times) until all cells contain valid observation data (). This step mathematically eliminates the rank-deficiency risk caused by local data absence, ensuring the numerical stability of the subsequent joint optimization.
2.4. Dual-Constrained Control Point Solver
Even with stable knot distributions, the solution in regions of extreme data sparsity, such as image edges, may remain ill-posed, causing oscillatory control points and distorted surfaces. To enhance robustness, we introduce a composite regularization term.
The loss function is defined as:
where
is the data fidelity term,
is an L2 regularization term that penalizes large control point values, and
is a smoothness constraint where
is a Laplacian matrix that penalizes second-order derivatives of the control point grid. The hyperparameters
and
balance fitting accuracy, numerical stability, and smoothness.
The design matrix
is constructed from B-spline basis functions evaluated at the parameter locations
. The resulting regularized system is solved via least squares:
where
and
are finite-difference operators along the rows and columns of the control point grid, respectively.