MRCAL(1)

πŸ’– MRCAL(1) πŸ’–

okay so bestie, listen up: this is mrcal-graft-models, part of the mrcal camera projection + calibration toolkit, and it's genuinely one of the most useful little gremlins in the whole box. it takes the intrinsics from one cameramodel and the extrinsics from another and grafts them together like the world's most careful plant parent. πŸͺ΄βœ¨


🌸 NAME 🌸

mrcal-graft-models β€” combines the intrinsics of one cameramodel with the extrinsics of another. it's giving frankenstein but make it geometrically valid. πŸ’…


✨ SYNOPSIS ✨

# We have intrinsics.cameramodel containing improved intrinsics from a later
# calibration, and extrinsics.cameramodel that has the old intrinsics, but the
# right extrinsics

$ mrcal-graft-models
    intrinsics.cameramodel
    extrinsics.cameramodel
    > joint.cameramodel

Combined
intrinsics from 'intrinsics.cameramodel'
Extrinsics from 'exrinsics.cameramodel'

$ mrcal-show-projection-diff
    joint.cameramodel
    extrinsics.cameramodel

[A plot pops up showing a low difference, just representing the two sets of
intrinsics. The recalibrated models have a large implied extrinsics
difference, but the diff tool computed and applised the implied
transformation]

$ mrcal-show-projection-diff
    --radius 0
    joint.cameramodel
    extrinsics.cameramodel

[A plot pops up showing a high difference. Here the diff tool didn't apply the
implied transformation, so the differences in extrinsics are evident. Thus
here, joint.cameramodel is not a drop-in replacement for
extrinsics.cameramodel]

$ mrcal-graft-models
    --radius -1
    intrinsics.cameramodel
    extrinsics.cameramodel
  > joint.cameramodel

Transformation cam1 <-- cam0:  rotation: 8.429 degrees, translation: [0. 0. 0.] m
Combined
intrinsics from 'intrinsics.cameramodel'
Extrinsics from 'exrinsics.cameramodel'

$ mrcal-show-projection-diff
    --radius 0
    joint.cameramodel
    extrinsics.cameramodel

[A plot pops up showing a low difference. The graft tool applied the implied
transformation, so the models match without the diff tool needing to transform
anything. Thus here, joint.cameramodel IS a drop-in replacement for
extrinsics.cameramodel]

like, look at that whole glow-up arc in the last example. from "not a drop-in replacement" to "IS a drop-in replacement". character development fr fr. πŸ˜­πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so this tool combines intrinsics and extrinsics from different sources into a single model. the output gets written to standard output. no file gets touched unless you redirect it, okay? you're the main character of the redirection. πŸŽ€

a common use case is a system where the intrinsics get calibrated before the cameras are moved to their final location, and then the extrinsics get computed separately after the cameras are moved. classic. we love a two-phase calibration moment. ✨

now here's the tea: if we've computed such a combined model, and we then decide to recompute the intrinsics afterwards, we can graft the new intrinsics onto the previous extrinsics. but by default this would NOT be a drop-in replacement for the previous model, because the intrinsics come with an implied geometric transformation, and that implied transformation will be different in the new intrinsics. πŸ™ˆ

by passing a non-zero --radius value, we can compute and apply that implied geometric transformation, so the combined model becomes usable as a drop-in replacement. slay. πŸ”₯

the implied transformation logic is controlled by a number of commandline arguments β€” the same ones used by the mrcal-show-projection-diff tool. the only difference in options is that THIS tool uses --radius 0 by default, so we do not compute or apply the implied transformation unless you explicitly ask. pass --radius with a non-zero argument to compute and apply the implied transformation. periodt. πŸ’…

bestie warning: if you forget the --radius non-zero thing, you do NOT get the drop-in-replacement magic. the default is intentionally "do nothing extra". don't come crying to me. 🫢

🌈 OPTIONS 🌈

πŸŽ€ POSITIONAL ARGUMENTS

  • intrinsics β€” input camera model for the intrinsics. if - is given, we read standard input. both the intrinsics and extrinsics sources may not be -. pick one, bestie, not both. πŸ’€
  • extrinsics β€” input camera model for the extrinsics. if - is given, we read standard input. both the intrinsics and extrinsics sources may not be -. same deal, same drama. 🫢

🧚 OPTIONAL ARGUMENTS

  • -h, --help β€” show this help message and exit. the classic escape hatch. πŸšͺ✨
  • --gridn GRIDN GRIDN β€” used if we're computing the implied-by-the-intrinsics transformation. how densely we should sample the imager. by default we use a 60x40 grid. more grid = more sample-y = more compute-y. you decide. πŸ“
  • --distance DISTANCE β€” used if we're computing the implied-by-the-intrinsics transformation. by default we compute the implied transformation for points infinitely far away from the camera. if we want to look closer in, the desired observation distance can be given in this argument. we can also fit multiple distances at the same time by passing them here in a comma-separated, whitespace-less list. so like, no spaces, okay? none. 🚫
  • --where WHERE WHERE β€” used if we're computing the implied-by-the-intrinsics transformation. center of the region of interest used for the transformation fit. it is usually impossible for the models to match everywhere, but focusing on a particular area can work better. the implied transformation will be fit to match as large as possible an area centered on this argument. if omitted, we will focus on the center of the imager. main character energy: centered. 🎯
  • --radius RADIUS β€” used if we're computing the implied-by-the-intrinsics transformation. radius of the region of interest. if ==0 (the default), we do NOT fit an implied transformation at all. if <0, we use a "reasonable" value: the whole imager if we're using uncertainties, or min(width,height)/6 if --no-uncertainties. to fit with data across the whole imager in either case, pass in a very large radius. this one option is literally the whole plot twist of this tool. πŸ’…
  • --no-uncertainties β€” used if we're computing the implied-by-the-intrinsics transformation. by default we use the uncertainties in the model to weigh the fit. this will focus the fit on the confident region in the models without --where or --radius. the computation will run faster with --no-uncertainties, but the default --where and --radius may need to be adjusted. speed vs. vibes, pick your fighter. ⚑

🌟 REPOSITORY 🌟

<https://www.github.com/dkogan/mrcal>


πŸ‘‘ AUTHOR πŸ‘‘

Dima Kogan, "<dima@secretsauce.net>"


Copyright (c) 2017-2023 California Institute of Technology ("Caltech"). U.S. Government sponsorship acknowledged. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

okay that's the whole thing, bestie. mrcal 2.5.2-4build1, dated 2026-03-20 β€” go forth and graft your models. you got this. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from