PHYSICAL AI | PERCEPTION ARCHITECTURE

Camera Calibration: From a Printed Target to a Lens Model

A camera model is a short list of numbers — two focal lengths, a principal point, and a few distortion coefficients — that turns a pixel into a ray and a ray into a measurement. Those numbers never show up in the photograph. They show up later, as a bias in every reconstructed point that was computed with them. Calibration is the work of recovering them from images of something whose geometry is already known.

Every stage between the target and the result can quietly corrupt the answer. A target printed at the wrong scale shifts the world units. A corner detector that settles on the wrong pixel adds a small systematic error to every view. A lens model with the wrong number of coefficients misdescribes the optics. And a solver can return a perfectly plausible result whose residual should have stopped the pipeline.

The lab walks that chain in the browser as four numbered steps: generate a target, capture and review the images, calibrate and read the report, then inspect the solved geometry and export it. This article follows the same path and explains the equations, the implementation choices, and the evidence behind them. A companion source repository is published as CameraCalibration on GitHub; the implementation described here is the hosted lab, and the published package may lag it.

The lab runs entirely in the page. Its numerical kernel is written in AssemblyScript and compiled to one WebAssembly module, detection and solving each run in their own worker, and there is no upload API — images are decoded and processed locally. The project is pre-alpha. The numerical evidence in this article is synthetic and oracle-based, not a real-camera accuracy claim, and nothing here should be read as production readiness. Where the evidence has a boundary, the boundary is stated explicitly, never hidden.

00 The target

A measurement standard, not a picture

A calibration target is a measurement standard. Its pattern defines the object coordinates that every detected image point will be paired with. If the printed pattern differs from the coordinates used in the solve, the fit absorbs that difference into the camera model, and no later stage can separate the two.

The lab therefore treats target generation as geometry, not as an image. A target is described by a PatternSpec: the pattern kind, the column and row counts, the square spacing in millimeters, the dot diameter for a circles grid, the dictionary for a marker board, the first marker id, the marker ratios, and the page margin. A PageSpec supplies the paper size and orientation. The same records feed the on-screen preview, the detector, and the PDF writer, so the geometry has one definition.

Pattern kinds and how they compare

Four pattern kinds are defined, and they are not interchangeable. Each trades off how easily corners are found against whether the board can be recognized in a partial view:

PatternCorner detectionIdentityPartial viewsTypical use
ChessboardReliable checkerboard finderNone (symmetric)Full board must be visibleSimple planar calibration
Circles gridBlob centers, robust to blurNoneFull grid must be visiblePhotogrammetry, dot targets
ArUco boardMarker match by Hamming distanceUnique per markerAny single marker sufficesPose estimation, SLAM
ChArUco boardChessboard corners + marker identityUnique per cellPartial board still placedCalibration under occlusion

The chessboard is the classic choice because its corner finder is fast and accurate, but a symmetric board cannot say which corner is which, and a partially occluded view cannot be used at all. ChArUco fixes both problems by fusing the two ideas: the ArUco markers inside alternating squares carry identity and a coarse lattice, while the chessboard intersections supply the precise geometric points. That is why the lab makes ChArUco its default and the only pattern it detects in the browser.

The shipped lab opens on a ChArUco board with 7 columns, 5 rows, and 30 mm squares (22 mm markers, ratio 0.73, DICT_4X4_1000) — the board the bundled capture set was generated from. Geometry is validated before it is used. Column and row counts must lie between 2 and 30, a marker ratio between 0.5 and 0.9 for ChArUco (0.5 to 0.95 for an ArUco board), and a custom page edge between 10 mm and 2000 mm; the complete board plus its margin must also fit the chosen page. A target that fails validation is rejected as a typed error, never partially applied.

For a ChArUco board, the marker count is derived from the cell count: a board with c×rc\times r cells carries

Nmarkers=⌊c r2⌋ N_{\mathrm{markers}} = \left\lfloor \frac{c\,r}{2} \right\rfloor

markers, because markers occupy the white squares of the alternating chessboard; an odd cell count therefore leaves one square without a marker. For an ArUco board the count is the full c rc\,r.

The ArUco identifiers come from dictionaries generated from OpenCV's predefined definitions. Only the rotation-0 payload of each marker is stored; the other three rotations are matched at runtime by rotating the candidate grid and taking the minimum Hamming distance. The payload is bit-packed most-significant-bit first, and a set bit means an OpenCV light cell. The packing is an implementation detail, but it preserves the exact bit identity of the reference dictionaries while shrinking the shipped data.

Exact printing and the scale check

The PDF writer emits vector geometry in PDF points, converting from millimeters as

ppt=smm×7225.4. p_{\mathrm{pt}} = s_{\mathrm{mm}}\times\frac{72}{25.4}.

Nothing in the file is rasterized, so the printed size is set by the geometry and by the printer's own scaling. The lab cannot control a printer. What it can do is make a scale error visible: when the target geometry leaves room for it, the page includes a 50 mm verification bar inside a 70 mm by 18 mm annotation box, labeled with the instruction to measure after printing. If that box does not fit, the bar is omitted explicitly, never clipped, and the target is marked as requiring manual measurement.

That is the honest version of a print check. A browser download does not control printer scaling, so the bar is evidence for the person holding the printout, not an automatic guarantee. Paper flatness, thermal expansion, and the printer's own dimensional accuracy remain physical uncertainty that the software cannot see.

The lab's target step: the live ChArUco board preview with its pattern controls — columns, rows, square size, marker length, and dictionary — beside the print and download actions.The lab's target step: the live ChArUco board preview with its pattern controls — columns, rows, square size, marker length, and dictionary — beside the print and download actions.
The lab's target step: the live ChArUco board preview with its pattern controls — columns, rows, square size, marker length, and dictionary — beside the print and download actions.

Limits of the target step

The generator defines the intended geometry exactly; it does not verify what came out of a printer. A target measured with a ruler has its own uncertainty, and a board that warps between sessions is no longer planar. The model also assumes the pattern lies on a plane, which is a good approximation for a rigid backing and a poor one for loose paper. These are physical limits, not software bugs, and they belong in the error budget of any real calibration.

01 Capture and review

Bringing frames in

Frames enter from the bundled synthetic set, from local image files, from a folder, or from a live camera. Intake is an adapter-injected controller: it checks image extensions, deduplicates by name, size and modification time, normalizes EXIF orientation so a rotated portrait becomes the upright pixel grid, and enforces an import budget before decode. A rejected item returns a stable reason and never enters the set.

The detection worker decodes each frame with createImageBitmap, draws it into an off-screen canvas, and converts the color image to an 8-bit grayscale buffer with the standard Rec. 601 luma weights. The decoded dimensions must match the request and stay inside the image contract; otherwise the worker fails closed before the kernel ever runs.

Markers first, corners second

A ChArUco frame is processed in two stages. First the detector finds ArUco markers: it builds an integral image, applies an adaptive threshold, labels connected components, and extracts quadrilateral candidates with the expected black border. Each candidate's inner payload is read and matched against every dictionary entry and rotation by Hamming distance; a marker is accepted only when the best match is close enough and unambiguous.

Once the markers are known, each matched marker is mapped straight to its board cell: the marker id indexes the white squares, so identity and cell position come from the same lookup. For each interior chess corner the detector gathers the adjacent markers and projects the integer corner coordinate through a local homography built from their corners, falling back to the global homography only when the local one cannot be formed. A corner without both adjacent markers is omitted, never extrapolated from distant markers. Detections with fewer than six corners are rejected, and the summary reports how many corners came from how many markers.

This is why ChArUco is useful: the markers supply identity and a coarse lattice, and the chessboard intersections supply the accurate geometric points. The marker identity also resolves the usual chessboard ambiguity about which corner is which, so partial views can still be placed correctly.

The hosted detector exposes the ChArUco path only. Chessboard, circles-grid and standalone ArUco boards can be generated, previewed and printed, but they are not detected in the browser: a detection request for an unsupported kind aborts with a typed error and never silently reinterprets it.

Sub-pixel refinement and provenance

Every published corner passes through a shared refinement stage: a gradient-weighted fixed-point update that samples bilinearly around the current floating-point position and iterates a bounded displacement toward the sub-pixel corner. The stage is deterministic and bounded by a maximum iteration count, an epsilon, and a maximum movement, and it halts at the bound instead of running away.

Each point records whether it converged, how far it moved, and how many iterations it took; a point that does not converge keeps its whole-pixel detector coordinate and carries a stable reason such as a degenerate gradient. The provenance is versioned and travels with the detection, so a point that kept its detector coordinate is distinguishable from one that was refined.

A frame is described as fully refined only when every published point was replaced by its estimate. The run aggregate counts frames, not error. It answers the question "did refinement run and converge?" and deliberately does not answer "how accurate is this corner?", because a converged refinement can still be biased by blur, glare, or a mislocated marker.

Typed outcomes and the detection worker

A detection is classified for review as okay, warn, or fail, from the corner coverage and the refinement provenance: a frame fails with no corners, coverage below half, a hard refinement failure, or more than a quarter of its points unrefined, and warns below 0.9 coverage or above 0.15 unrefined. The human-readable summary text is not the contract; the interface reads the typed state, so a screen cannot quietly treat a partial detection as a success. An excluded frame stays visible in the review but never enters the solve, which needs at least three included frames.

Detection runs in an isolated module worker off the interaction thread. The worker receives the grayscale buffer and the target specification, validates both against a bounded decode contract, runs the ChArUco detector compiled to WebAssembly, and returns a versioned payload. The kernel refuses inputs above its own capacity — a 1920×1080 image, 8192 components, 512 markers, 512 corners — and never overruns a buffer.

The capture and review step showing one of the fifty demo frames with all 24 detected corners marked as yellow rings, the thumbnail strip, and the per-frame include control.The capture and review step showing one of the fifty demo frames with all 24 detected corners marked as yellow rings, the thumbnail strip, and the per-frame include control.
The capture and review step showing one of the fifty demo frames with all 24 detected corners marked as yellow rings, the thumbnail strip, and the per-frame include control.

Limits of the detection step

Refinement is bounded and deterministic, which makes it reproducible; it is not a claim of universal sub-pixel accuracy. A corner can be systematically displaced by motion blur, specular highlights, or a printed marker that is smaller than the model assumes. The marker-identity step can also fail on a heavily occluded or strongly distorted frame. Those cases are reported as typed outcomes, not smoothed over, and the frame review surface is where a person decides whether to keep a view.

02 Calibrate and report

A named, versioned contract

The model is not just an equation; it is an identified contract. The Brown model carries the stable identifier nidvue-brown-opencv-5-v1, and the coordinate conventions carry target-mm-camera-right-down-forward-pixel-center-v1. Both identifiers are written into result provenance, and the result verifier checks them. A stored result therefore states which mathematical model produced it, not merely that "a calibration" ran.

The contract fixes three things that are easy to leave implicit.

Frames and units. Target points are (Xw,Yw,0)(X_w, Y_w, 0) in millimeters, in a right-handed frame where +Xw+X_w follows increasing target columns, +Yw+Y_w follows increasing rows, and +Zw=+Xw×+Yw+Z_w = +X_w \times +Y_w. Camera coordinates are OpenCV's: +Xc+X_c right, +Yc+Y_c down, +Zc+Z_c forward. Extrinsics map target to camera coordinates as

Pc=R(rvec) Pw+tvec, \mathbf{P}_c = \mathbf{R}(\mathbf{rvec})\,\mathbf{P}_w + \mathbf{tvec},

with tvec\mathbf{tvec} in millimeters.

Pixels. Image coordinates are continuous pixels with (0,0)(0,0) at the center of the top-left pixel, +u+u right and +v+v down. There is no half-pixel adjustment. It is a choice, but a stated one, and the detector and the solver use the same rule.

Rejection. A point with non-finite coordinates or Zc≤10−9 mmZ_c \le 10^{-9}\,\mathrm{mm} is rejected instead of projected. A degenerate depth is not allowed to become a large coordinate that the optimizer then tries to explain.

Projection and distortion

For a target point, the normalized camera coordinates are x=Xc/Zcx = X_c / Z_c and y=Yc/Zcy = Y_c / Z_c. The Brown model solves five coefficients, [k1,k2,p1,p2,k3][k_1, k_2, p_1, p_2, k_3], with every coefficient active: three radial terms, tangential terms enabled, and independent focal lengths with zero skew.

With r2=x2+y2r^2 = x^2 + y^2 and

radial⁡=1+k1r2+k2r4+k3r6, \operatorname{radial} = 1 + k_1 r^2 + k_2 r^4 + k_3 r^6,

the distorted normalized coordinates are

xd=x radial⁡+2p1xy+p2(r2+2x2),yd=y radial⁡+p1(r2+2y2)+2p2xy, \begin{aligned} x_d &= x\,\operatorname{radial} + 2 p_1 x y + p_2\left(r^2 + 2x^2\right), \\ y_d &= y\,\operatorname{radial} + p_1\left(r^2 + 2y^2\right) + 2 p_2 x y, \end{aligned}

and the pixel projection is

u=fxxd+cx,v=fyyd+cy. \begin{aligned} u &= f_x x_d + c_x, \\ v &= f_y y_d + c_y. \end{aligned}

The intrinsic matrix is exactly

K=[fx0cx0fycy001], \mathbf{K} = \begin{bmatrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{bmatrix},

with fxf_x and fyf_y in pixels, cxc_x and cyc_y in pixels, and distortion coefficients dimensionless.

The first two radial terms and the two tangential terms are the common case; the third radial term k3k_3 matters near the edge of the field. Naming all five explicitly means the export order can never drift: the coefficient vector is always [k1,k2,p1,p2,k3][k_1, k_2, p_1, p_2, k_3].

Brown–Conrady v1 distortion preview using the project's oracle truth parameters K = fx 820, fy 815, cx 639.5, cy 359.5 at 1280x720 and coefficients k1 -0.08, k2 0.015, p1 0.0007, p2 -0.0004, k3 -0.002.Brown–Conrady v1 distortion preview using the project's oracle truth parameters K = fx 820, fy 815, cx 639.5, cy 359.5 at 1280x720 and coefficients k1 -0.08, k2 0.015, p1 0.0007, p2 -0.0004, k3 -0.002.
Brown–Conrady v1 distortion preview using the project's oracle truth parameters K = fx 820, fy 815, cx 639.5, cy 359.5 at 1280x720 and coefficients k1 -0.08, k2 0.015, p1 0.0007, p2 -0.0004, k3 -0.002.

Three lens models

Brown is not the only model the lab can fit. Three families are selectable, each with its own contract and its own covariance shape, and the choice should follow the optics rather than the scoreboard:

ModelCoefficientsWhen to use it
Brown[k1,k2,p1,p2,k3][k_1, k_2, p_1, p_2, k_3]The default; matches OpenCV's plumb_bob for ordinary rectilinear lenses
Rational[k1,k2,p1,p2,k3,k4,k5,k6][k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6]Wide-angle lenses where the Brown polynomial diverges at the edge
Fisheye[k1,k2,k3,k4][k_1, k_2, k_3, k_4] equidistantFisheye and omnidirectional optics; no tangential terms

A five-coefficient polynomial is a local approximation. Extrapolating it beyond the field covered by the calibration views is not supported by the data, and a lens whose distortion is not well described by five terms will leave a structured residual. The rational model adds a reciprocal radial denominator that can track wide-angle distortion without exploding at the edge, but its three extra coefficients are weakly constrained and can fit noise. The fisheye model drops tangential terms entirely and uses the equidistant projection, which is the right form for a fisheye lens and the wrong form for a rectilinear one.

This is the same trade-off every calibration tool makes, just made explicit. OpenCV ships the pinhole and fisheye families, MATLAB's camera calibrator targets Brown, Kalibr adds an omnidirectional model, and mrcal is built around propagating uncertainty. The lab's contribution is not a new model; it is the typed provenance, the solver that refuses to continue on error, and the uncertainty block that say which model ran and how much each coefficient is actually believed. Nothing silently falls back to Brown; an unsupported option combination is rejected, never quietly simplified.

Residual and RMS definitions

The residual is predicted minus observed, per coordinate:

ri=(upred−uobs,  vpred−vobs). \mathbf{r}_i = \left(u_{\mathrm{pred}} - u_{\mathrm{obs}},\; v_{\mathrm{pred}} - v_{\mathrm{obs}}\right).

The application reports RMS per coordinate over all points:

RMS⁡app=∑i(Δui2+Δvi2)2N. \operatorname{RMS}_{\mathrm{app}} = \sqrt{\frac{\sum_i \left(\Delta u_i^2 + \Delta v_i^2\right)}{2N}}.

OpenCV's calibrateCamera reports a per-point RMS instead, so comparing the two requires

RMS⁡opencv=RMS⁡app2. \operatorname{RMS}_{\mathrm{opencv}} = \operatorname{RMS}_{\mathrm{app}}\sqrt{2}.

That factor is not a rounding detail. A comparison that ignores it will look like a disagreement when both implementations actually agree. The oracle comparison therefore converts explicitly instead of comparing the two numbers directly.

Seeding and refinement

The solver starts from a closed-form estimate. Zhang's method uses the homographies between the target plane and each image to write constraints on the intrinsic matrix, and those six constraints require at least three homographies. The implementation builds each homography and solves for the intrinsics with a bounded one-sided Jacobi SVD over the original design matrix. It does not form the normal matrix ATAA^{\mathsf T} A, so it avoids squaring the condition number, and it introduces no runtime dependency outside the repository's pinned offline vendor set.

Zhang's closed form is not the only way in, and the choice matters. A direct linear transform is simpler but assumes a distortion-free pinhole and cannot recover lens distortion at all. Self-calibration needs no target, but it is less accurate and more ambiguous, and it is the wrong tool when a printed board is available. The lab follows the standard path — a Zhang seed, then a nonlinear refinement that fits the distortion coefficients against every observation at once.

After the intrinsics are seeded, each view's pose is estimated and the full parameter vector is assembled. A deterministic consensus seed is available as an automatic fallback when the Zhang path is singular or poorly conditioned, and the executed seeding path is recorded in the result.

Refinement is a Levenberg–Marquardt optimization over [fx,fy,cx,cy,k1,k2,p1,p2,k3][f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3] and the per-view pose parameters, using central finite differences. The solve is bounded by design: a plan caps the number of views, points, residual evaluations, parameters, iterations, projection operations, memory, and elapsed time, and those checks run before large allocations and at regular checkpoints. A solve that would exceed its budget halts with a typed error before it can exhaust the browser.

A Huber robust loss is available for frames with outliers, using an iteratively reweighted least-squares pass with a median-absolute-deviation scale; a solve that trims more than half its points refuses to return a trimmed-set answer. Neither option changes the frozen default, so the reference result bytes stay reproducible.

Uncertainty and cross-validation

Where the model allows it, the solver computes a final-Jacobian covariance for the nine intrinsic and distortion parameters [fx,fy,cx,cy,k1,k2,p1,p2,k3][f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3] using the 2N−p2N-p denominator, which is the correct degrees-of-freedom convention and is not the same as the reported per-coordinate RMS denominator. Pose uncertainty is marginalized out, not treated as known. The solver stores the 45 unique entries of the symmetric 9×99\times 9 covariance, not just the diagonal, and reports approximate 95% intervals as 1.96 standard deviations. When the estimate cannot be formed, it records an explicit unavailable status with a stable reason. A missing uncertainty is never rendered as zero.

The report also runs a five-fold cross-validation: the views are shuffled with a fixed seed, the camera is refit on each training split, and each held-out view is then scored with only its six pose parameters refit against the training camera. The aggregate is the root mean square over the held-out corners, and all folds must succeed — a partial average is never returned. This measures how well the model fits views it did not train on, which is the closest thing a single capture session can offer to generalization evidence.

Eight evidence checks then grade the result: view count, image and edge coverage, pose and depth spread, residual, convergence, focal-length precision, held-out fit, and a sampled radial-mapping check. They combine into a confidence score equal to the fraction of checks that pass, capped at 0.84 when any check is not a pass and at 0.59 when three or more fail, the radial-mapping check fails, or any projection fails, so a stack of nearly identical images can never earn a high grade. These are acquisition heuristics, not probabilities of accuracy.

Errors are typed throughout. Invalid options, non-finite input, underconstraint, degenerate geometry, a singular initialization, a resource overflow, and failure to reach cost tolerance are distinct classes. No result is produced on an error, and the interface clears any prior transient result so a stale success cannot survive beside a fresh failure.

The oracle benchmark and the bundled demo

The strongest numerical evidence in the project is an offline oracle comparison, and it is deliberately narrow. A checked-in fixture was generated independently by OpenCV 5.0.0 and NumPy, not by the application. The frozen Brown oracle benchmark, the opencv-brown-v1.json fixture, uses eight views of a 9×69\times 6 board with 25 mm pitch and zero noise, giving 432 projections, and verifies the application against that oracle within fixed tolerances:

QuantityTolerance
Projection≤0.0002\le 0.0002 px per coordinate
fxf_x, fyf_y≤0.0001\le 0.0001 relative
cxc_x, cyc_y≤0.05\le 0.05 px
k1k_1≤0.001\le 0.001
k2k_2≤0.002\le 0.002
p1p_1, p2p_2≤0.0001\le 0.0001
k3k_3≤0.005\le 0.005
RMS≤0.0001\le 0.0001 px
Rotation vector≤0.001\le 0.001 rad
Translation≤0.2\le 0.2 mm
Repeat solve≤10−12\le 10^{-12}

The same fixture proves provenance locking, intrinsic and distortion recovery, extrinsic recovery, repeat-solve determinism, fail-closed error behavior, and round-trip exports through independent JSON, OpenCV YAML, and ROS YAML parsers within 10−1210^{-12}. What this establishes is that the implementation reproduces a controlled synthetic reference; what it does not establish is real-camera accuracy. The benchmark is a correctness gate for the code, not a specification for a physical measurement.

The bundled demo is the other half of the evidence, and it is a different kind of test. Fifty synthetic frames of a rigid ChArUco board sit on an articulated support in a daylight workroom — oak desk, plaster wall, books, notebook, ceramic objects — rendered in Blender Cycles so the board, its backing, its shadows, and its background share one light transport calculation. Small camera translations and rotations, plus a 1.2% lighting variation, produce slightly different backgrounds across frames. The pose plan samples the image center, edges and corners, opposing pitch and yaw, combined tilt, gentle roll, and near and far distances; it is fixed before detection, so frames are not chosen to flatter the residual.

Run through the actual detector and solver, all fifty views return 24 corners each, and the fit lands on:

QuantityFitted valueRenderer truth
fxf_x900.01 px900 px
fyf_y899.96 px900 px
cxc_x479.14 px480 px
cyc_y358.26 px360 px
Corner RMS0.131 px—
Cross-validation fold RMS0.132 px—

The focal lengths and principal point come back essentially exact. The higher-order radial term is where the spread shows: the fit recovers k3k_3 near −0.019 against a truth of −0.008, with a standard deviation larger than the value itself. The capture does not pin down the sixth-order term, and the uncertainty block says so without hiding it. Those figures describe that synthetic capture, not a real camera, and they are roughly three orders of magnitude looser than the 0.0001 px oracle tolerance because they include the synthetic capture's own edge cases instead of an exact projection.

The report step after a fifty-view Brown solve: the critical values, the distortion coefficients, the per-frame residual summary, and the confidence grade.The report step after a fifty-view Brown solve: the critical values, the distortion coefficients, the per-frame residual summary, and the confidence grade.
The report step after a fifty-view Brown solve: the critical values, the distortion coefficients, the per-frame residual summary, and the confidence grade.

Limits of the solve

A calibration can converge to the wrong minimum. Weak pose diversity, a target that stays near the image center, or a small number of views can leave the parameters poorly constrained even when the residual is small. The uncertainty block, the cross-validation report, and the per-frame residual view exist precisely so that a small overall RMS is not accepted as sufficient evidence on its own. The benchmark tolerances are a code gate, not a tolerance for a physical system, and no real-camera accuracy claim is made.

03 Geometry and export

Seeing the solve

The final step draws the calibrated board poses in camera coordinates, with the camera at the origin, using the same projection model and image size as the report. It is an inspection aid, not a measurement instrument: the point is to see at a glance whether the board poses form a sensible spread around the camera, not a degenerate cluster, and whether the camera sits inside the volume the views actually covered. The view runs in a dependency-free WebGL viewer, so the geometry is visible without re-solving or re-detecting.

The geometry step: the solved board poses drawn around the camera at the origin in the WebGL viewer, with the export actions below.The geometry step: the solved board poses drawn around the camera at the origin in the WebGL viewer, with the export actions below.
The geometry step: the solved board poses drawn around the camera at the origin in the WebGL viewer, with the export actions below.

Writing the result out

Verified results can be exported in several forms, all generated from the one in-memory record so they agree by construction. A versioned JSON envelope carries the model and coordinate contract identifiers, the solver iteration count and convergence reason, and the complete result. OpenCV YAML writes model: plumb_bob, a zero-skew 3×33\times 3 camera matrix, a 1×51\times 5 distortion vector in [k1,k2,p1,p2,k3][k_1,k_2,p_1,p_2,k_3] order, and the application's per-coordinate RMS. ROS YAML writes a camera_info-shaped message with an identity rectification matrix and a 3×43\times 4 projection matrix. Kalibr YAML writes a pinhole/radtan camera and returns a typed error when a Brown k3 sits outside the omission tolerance. Markdown, PowerPoint and PDF renders print exactly the values the report carries — an uncomputable metric is already null and becomes an em dash, never a fabricated number. Every exporter refuses to write on error: an unsupported model, a non-solved state, or an unverified record produces no bytes.

Integration and further work

The calibration described here is a component, not a product. Downstream systems consume the intrinsics and distortion model, and their own error budgets must include calibration uncertainty instead of treating the parameters as exact.

Several extensions remain open. Independent real-camera evaluation would acquire images with known reference geometry, repeated sessions, different surfaces, and an independent measurement of the reference, and would report bias and repeatability alongside the residual. A per-pixel projection-uncertainty field would propagate parameter covariance into the image instead of reducing it to a single number. Multi-camera setups would add inter-camera extrinsics and a common world frame. And a print-scale workflow would connect the generated target to a measured printout without pretending that a browser controls a printer.

Each of those needs its own evidence. The current registry treats this kind of calibration as an internal engineering result until a deployment exists and a separate review approves any external claim.

In the lab, you can change the board, import your own images, pick a lens family, and watch the residual report and the solved geometry respond. Comparing the residual against the uncertainty block — without trusting either on its own — is the fastest way to see which stage still needs work and what evidence a production calibration would still require.

The numerical results in this article are synthetic or oracle-based and describe the implementation, not a physical camera. Publication of any external claim based on this work requires separate review and approval.

References

The implementation draws on standard camera-calibration and fiducial-marker methods. The references below explain the foundations; they do not validate this implementation's accuracy.

  • Brown, D. C. (1966). Decentering distortion of lenses. Photogrammetric Engineering, 32(3), 444–462. The origin of the radial–tangential polynomial form commonly called Brown–Conrady, with the five-coefficient order used here.
  • Zhang, Z. (2000). A flexible new technique for camera calibration. IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11), 1330–1334. The planar-target method whose homography constraints seed the solve. DOI
  • Garrido-Jurado, S., Muñoz-Salinas, R., Madrid-Cuevas, F. J., & Marín-Jiménez, M. J. (2014). Automatic generation and detection of highly reliable fiducial markers under occlusion. Pattern Recognition, 47(6), 2280–2292. The ArUco marker family used for board identity. DOI
  • OpenCV. Detection of ChArUco Boards. Documentation for the combined chessboard–ArUco board and its corner-detection procedure. Documentation
  • OpenCV. Camera Calibration. Documentation for the pinhole model, the distortion coefficient order, and the calibration error convention used in the oracle comparison. Documentation
  • Hartley, R., & Zisserman, A. (2004). Multiple View Geometry in Computer Vision (2nd ed.). Cambridge University Press. The general treatment of the intrinsic matrix, homographies, and planar calibration.