A calibration that exists only in an interactive workspace is not ready for production reuse. You need a saved artifact that reconstructs the same camera model after the application closes, the computer restarts, or a recipe changes. This procedure is for an unchanged imaging setup: the same camera, lens settings, image geometry, and relevant mechanical relationships. You will choose a storage format, preserve the parameter conventions, and verify a clean-session reload numerically before using the calibration for inspection.
Choose a storage strategy
You do not need XML specifically. A supported native object format can preserve a calibration directly, while a portable parameter record can preserve the information needed to reconstruct it. The correct choice depends on the receiving application and its documented loading interface.
| Storage approach | Best use | What to preserve | Main limitation |
|---|---|---|---|
| Native serialized object | Reuse within a supported software environment | Calibration object, software version, and associated metadata | Compatibility may depend on installed classes and software versions |
| Portable parameter record | Long-term storage, inspection, or reconstruction through a documented API | Camera model, named parameters, dimensions, units, and conventions | Your loader must interpret every field correctly |
| Generated reconstruction code | Environments with a documented code-export feature | Generated code, referenced data, and required software version | Code may depend on external files or version-specific interfaces |
For a stable production application, use the documented native format as the primary runtime artifact when supported. Consider retaining a portable record alongside it for inspection and migration. Both should identify the same calibration revision, rather than becoming independently edited copies.
A filename extension does not establish compatibility. A text file containing coefficients is useful only when the receiving software understands their mathematical meaning. Cross-package reconstruction requires additional checks; the calibration format conversion guide explains those concerns for stereo systems.
Record the calibration contract
Before saving anything, define what the saved artifact represents. Intrinsic calibration describes the camera's projection and distortion model. Extrinsic calibration describes a coordinate relationship, such as a camera pose relative to a fixture. They may need different validity checks.
Preserve at least the following information:
| Field group | Required detail | Why it matters |
|---|---|---|
| Camera identity | Device identifier, lens identity, calibration revision | Prevents selecting another camera's calibration |
| Projection model | Exact model name and documented equations or definition | Different models cannot safely share an unlabeled coefficient vector |
| Intrinsics | Focal parameters, principal point, and any supported skew term | Defines conversion between normalized coordinates and image pixels |
| Distortion | Coefficient names, order, direction, and normalization | Prevents interpreting the same values through different equations |
| Image geometry | Width, height, crop, binning, orientation, and relevant processing | Ties the parameters to the pixel coordinates they describe |
| Coordinate conventions | Origin, axis directions, matrix layout, and transform direction | Prevents transposition, sign, and indexing errors |
| Physical units | Units of calibration target coordinates and translations | Prevents scale errors in reconstructed poses and measurements |
| Provenance | Creation date, software version, schema version, and validation results | Makes later reconstruction and auditing practical |
Record image dimensions as explicitly named width and height fields. An unlabeled pair such as [1280, 960] can become height followed by width in another interface.
For a conventional pinhole model, focal parameters and principal-point coordinates are commonly expressed in pixels. Distortion coefficients are often dimensionless, but that depends on the model's normalization. Target coordinates and translation vectors carry physical units. Never assign units solely from a field's name.
Also distinguish a transform from camera coordinates to fixture coordinates from its inverse. Calibration-target poses from individual calibration images are not automatically the operating pose of the installed camera.
Save and reload in a clean session
Use the following sequence with the documented persistence interface supplied by your software. Do not assume that every object supports generic serialization or reconstruction from every visible property.
-
Export the actual calibration result. Obtain the calibration object or documented parameter export, not just an application window, preview image, or report. Confirm its class or model identifier and inspect the image dimensions before saving.
-
Write a versioned artifact. Use the supported native save operation, or export a complete portable record. Give the artifact a calibration revision and record that revision in the inspection recipe. Avoid filenames that imply an unspecified current version.
-
Preserve reconstruction inputs. For a portable record, export documented constructor inputs or writable calibration fields. Do not blindly copy every object property: some properties are derived, read-only, or dependent on other settings. Retain any separate files required by generated reconstruction code.
-
Write safely. Save to a temporary destination, close the writer, and check that the temporary artifact loads successfully. Then promote it using a replacement procedure supported by the operating system and storage location. Keep the previously validated revision available for rollback.
-
Reload in a new process. Close the calibration session and start the intended runtime independently. Load from an explicit configured location, not an accidental working directory. Confirm that required classes, packages, and documented licenses are available through legitimate installations.
-
Reconstruct and check the result. For native storage, inspect the loaded object's type and key fields. For a portable record, construct the documented camera model and assign parameters through its supported interface. Reject unsupported schema versions, missing fields, nonfinite values, and inconsistent dimensions.
-
Exercise the production loading path. Restart the inspection application and select the relevant recipe. Verify which calibration revision was loaded and run the numerical checks below. A successful test in an interactive console does not prove the deployed startup path works.
If loading depends on a specific runtime, verify that relationship before deployment. The camera acquisition software compatibility guide covers the wider integration checks that often accompany these dependencies.
Keep validated calibration artifacts read-only to the production account where practical. A file checksum can detect unexpected byte changes, but it does not establish that the parameters are correct or trustworthy.
Validate the round trip numerically
Test two separate questions: did storage preserve the model, and does that model still describe the imaging setup? A reload can pass the first question while failing the second.
Start by comparing metadata and named fields. Require exact agreement for model identifiers, image dimensions, coefficient order, units, and coordinate conventions. Compare floating-point values with tolerances appropriate to the stored precision and application.
Then compare the original and reloaded models through projection. Use identical synthetic camera-coordinate points spanning the useful field, including locations near the image edges. For a pinhole projection without distortion or skew:
Here, X, Y, and Z share the same physical unit, while u and v are pixel coordinates. For the complete test, apply the documented distortion model as well. An undistorted central point alone cannot reveal most coefficient-order mistakes.
As a synthetic arithmetic check, suppose fx = 1200 pixels, cx = 639.5 pixels, and X/Z = 0.1. The horizontal projection is 1200 × 0.1 + 639.5 = 759.5 pixels. These are illustrative values, not camera specifications. A transposed intrinsic matrix or changed coordinate origin can produce a different answer despite retaining similar-looking numbers.
Compare the original and reloaded projections using:
For example, suppose all 20 test points differ by 0.003 pixels horizontally and 0.004 pixels vertically:
- Squared displacement per point:
0.003² + 0.004² = 0.000025 pixels². - Sum across the points:
20 × 0.000025 = 0.0005 pixels². - RMS displacement:
sqrt(0.0005 / 20) = 0.005 pixels.
That would pass an application-defined round-trip limit of 0.01 pixels. This limit is illustrative, not a universal acceptance threshold. Select yours from numerical precision and measurement requirements.
Finally, evaluate saved reference images or independent target observations against the acceptance limits established during calibration. Round-trip agreement proves preservation, not calibration accuracy. For interpreting distortion and corrected output, use the unrectified camera image guide.
Keep calibration tied to its image geometry
The saved calibration must describe the images supplied to the measurement function. Matching camera identity alone is insufficient.
A crop changes the coordinate origin. Resizing changes focal parameters and principal-point coordinates according to the resize mapping. Rotation and mirroring change coordinate relationships. Binning or camera-side processing can also change the relevant geometry and requires documented handling or renewed validation.
For a simple crop with no resampling, removing 100 pixels from the left changes a principal point of 639.5 pixels to 539.5 pixels in the cropped coordinate system. The calculation is 639.5 - 100 = 539.5 pixels. This adjustment alone does not define every cropped-image processing pipeline: check what coordinates the receiving function expects.
Similarly, converting from zero-based to one-based coordinates shifts a corresponding point by 1 pixel along each affected axis. Record the convention instead of silently applying an offset. The image rotation guide helps separate display orientation from changes to the image used for processing.
Store acquisition settings alongside the calibration contract, including resolution, region of interest, and image orientation. Record lens focus and zoom settings where adjustable. A saved file cannot compensate for a changed optical setup.
If hardware, mounting, or relevant lens settings have changed, follow the separate vision calibration recovery procedure. Reloading an old artifact is not a substitute for validating the new setup.
Diagnose reload failures before recalibrating
A load failure does not automatically mean that the calibration must be repeated. Isolate the persistence problem first.
| Symptom | First check | Corrective action |
|---|---|---|
| File exists but cannot be reconstructed | Object class and supported software versions | Use a documented compatible runtime or migration procedure |
| Loaded result is a wrapper rather than a camera model | Saved variable names and container structure | Extract the intended record, then reconstruct through the supported interface |
| Values match but projections differ | Matrix layout, model definition, coefficient order, and pixel origin | Correct the loader's interpretation and repeat projection tests |
| Calibration works manually but not after restart | Configured path, permissions, and startup sequence | Use explicit paths and log the selected revision |
| Center agrees but edges differ | Distortion interpretation and image geometry | Verify distortion direction, normalization, and any crop or resize |
| Geometry agrees but physical scale differs | Target-coordinate and translation units | Reconstruct with consistent units and revalidate scale |
Do not silently fall back to a different calibration when loading fails. Report the fault, retain diagnostic information, and handle affected inspection results according to the application's documented failure policy.
Check hardware and software requirements before ordering
Persistence is primarily a software requirement, not a reason to replace a functioning camera. For area scan cameras, establish which application owns the calibration and how its runtime loads it. The camera finder helps compare acquisition hardware once those requirements are defined.
The LS-CMR-0053 is a catalog option for a GigE acquisition design. Confirm the calibration application's supported acquisition path separately; camera connectivity does not establish object-file compatibility.
- Sensor format
- 1/1.7"
- Interface
- GigE
- Resolution
- 12 MP
- Shutter
- Rolling
The LS-CMR-0166 is a catalog option for a USB3 acquisition design. Apply the same persistence acceptance test to the complete software and camera configuration.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
For smart cameras, ask whether calibration is stored within a job, exported separately, or linked through another documented mechanism. Confirm backup and restoration behavior for the selected device and software rather than assuming it from the category.
For vision controllers, document the runtime dependencies, calibration-file location, permissions, and startup sequence. Port availability alone does not establish support for your chosen calibration format.
Release checklist and next step
Before approving calibration reuse, verify that:
- The artifact identifies its camera model, revision, and intended imaging setup.
- Image dimensions, distortion conventions, matrix layout, and units are explicit.
- A clean-session load reconstructs the expected object or parameter record.
- Projection comparisons cover the image center and edges.
- Reference-image measurements meet the application's acceptance criteria.
- The production recipe loads the intended revision after restart.
- A missing or incompatible file creates a visible fault rather than an unnoticed substitution.
- The validated artifact and rollback copy are protected from unintended edits.
Keep a short validation report beside each released revision. Include the software version, test dataset identifier, numerical tolerances, and pass or fail results.
For a new acquisition system, start with the camera configurator. If you need help defining the hardware and software boundary, send the image geometry, intended calibration format, and runtime requirements through application support.
Questions
Do camera calibration parameters have to be saved as XML?
No. Use a format supported by your calibration software and production runtime. A native serialized object may be the simplest option within a compatible environment. A portable record is useful when you need explicit fields, but it must preserve the model definition, coefficient order, image geometry, units, and coordinate conventions.
Do I need to recalibrate the camera every time the application starts?
An unchanged, validated imaging setup normally permits reuse of its saved calibration. Confirm that the application loads the intended revision and that acquisition geometry matches the calibration record. Repeat validation when focus, zoom, mounting, image processing, or other relevant conditions change; recalibrate when the existing model no longer meets requirements.
Can I rebuild a calibration object from its exported properties?
Only when the documented constructor accepts those properties as reconstruction inputs. Some object properties are calculated, read-only, or dependent on other fields. Build the export around the software's documented persistence or reconstruction interface, then test the reconstructed model against the original using points across the useful image field.
Will a saved calibration work after a software upgrade?
Treat the new software version as a compatibility change. Test loading a copy of the artifact in the target runtime, compare its metadata and projected points, and run reference-image measurements. Preserve the original artifact and supported runtime until the migrated version has passed your documented acceptance checks.
Is a low reprojection error enough to validate a saved calibration?
A low calibration error describes how a fitted model agreed with its calibration observations. It does not prove that a later save and load preserved the model. Test round-trip projection agreement separately, then use independent observations or reference measurements to confirm that the restored calibration remains suitable for the application.

