MRCAL(1)

πŸ“¦
version 2.5.2 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

✨ MRCAL-FROM-KALIBR ✨

okay bestie, welcome to the mrcal manual β€” this one is mrcal: camera projection, calibration toolkit, and today we're doing MRCAL(1). buckle up πŸŽ€

🌸 NAME 🌸

mrcal-from-kalibr</pulple> β€” the lil bestie that converts a kalibr-formatted camera model into the .cameramodel file format πŸ’…

(yeah it's a format glow-up, not a whole personality transplant, we'll get there)


πŸ¦‹ SYNOPSIS πŸ¦‹

watch this, it's literally the whole plot:

$ cat model.yaml

cam0:
  camera_model: pinhole
  intrinsics: [461.629, 460.152, 362.680, 246.049]
  distortion_model: radtan
  distortion_coeffs: [-0.27695497, 0.06712482, 0.00087538, 0.00011556]
  T_cam_imu:
  - [0.01779318, 0.99967549,-0.01822936, 0.07008565]
  - [-0.9998017, 0.01795239, 0.00860714,-0.01771023]
  - [0.00893160, 0.01807260, 0.99979678, 0.00399246]
  - [0.0, 0.0, 0.0, 1.0]
  timeshift_cam_imu: -8.121e-05
  rostopic: /cam0/image_raw
  resolution: [752, 480]

$ mrcal-from-kalibr model.yaml

Wrote model-cam0.cameramodel

$ cat model-cam0.cameramodel

{
    'lensmodel':  'LENSMODEL_OPENCV4',

    # intrinsics are fx,fy,cx,cy,distortion0,distortion1,....
    'intrinsics': [ 461.629, 460.152, 362.68, 246.049, -0.27695497, 0.06712482, 0.00087538, 0.00011556,],

    'rt_cam_ref': [ 0, 0, 0, 0, 0, 0,],
    'extrinsics': [ 0, 0, 0, 0, 0, 0,], # for compatibility with mrcal < 2.5

    'imagersize': [ 752, 480,],
}

like… look at that output. ate and left no crumbs πŸ˜­πŸ’–


πŸ’œ DESCRIPTION πŸ’œ

okay so first thing, the file formats mrcal supports are all written down here, go be nosy:

<https://mrcal.secretsauce.net/cameramodels.html#cameramodel-file-formats>

This tool converts the model(s) you hand it into the mrcal-native .cameramodel file format. And ngl, that is it β€” no changes to the content are made, this is purely a format converter. (If you actually want to fit different lens models, that's a different girl: the mrcal-convert-lensmodel tool. know the difference, iykyk 🫢)

You give the model filenames on the commandline. Output gets written to the same directory, with the same filename, but annotated with the camera name from the data file, and with a .cameramodel extension. slay ✨

If the model is omitted or given as -, the input is read from standard input, and the output is written to standard output. very pipe-friendly of her πŸ’…

real talk though: unlike mrcal .cameramodel files where one camera is described by one file, the .yaml files used by kalibr are intended to describe multiple cameras. so this format conversion tool will write out multiple .cameramodel file to represent the given data. if you only want one of them, pass --camera CAMERA.

By default we set the extrinsics of camera-0 as they appear in the input: the "previous" camera from camera-0 is used as the reference coordinate system. If we want to force camera-0 to have an identity transform, pass --cam0-at-reference. Usually this will be the case anyway in the input data, but this option makes sure. πŸ‘‘

The kalibr format is described at <https://github.com/ethz-asl/kalibr/wiki/Yaml-formats> β€” go read it, she's the source fr fr.

At this time we only support:

  • LENSMODEL_PINHOLE
  • LENSMODEL_OPENCV4
  • LENSMODEL_CAHVOR (experimental)
  • LENSMODEL_CAHVORE (experimental)

which corresponds to

camera_model == 'pinhole' and distortion_model in ('radtan','none')

two of those are lowkey experimental, so temper your expectations bestie 🧚


✨ OPTIONS ✨

🌈 POSITIONAL ARGUMENTS

  • model β€” the input camera model; use - to read standard input. give me the goods or give me stdin 🫢

πŸŽ€ OPTIONAL ARGUMENTS

  • -h, --help β€” show this help message and exit. the classic. the icon.
  • --cam0-at-reference β€” By default we set the extrinsics of camera-0 as they appear in the input. If we want to force camera-0 to have an identity transform, pass --cam0-at-reference. Usually this will be the case anyway in the input data, but this option makes sure. it's the "no like actually make it identity" button πŸ’…
  • --camera CAMERA β€” Kalibr model files may contain multiple cameras, selected by this argument. If omitted, all available cameras will be read. If given, we read JUST the one requested camera. one camera, one vibe, no sharing 🎯
  • --force, -f β€” By default existing files are not overwritten. Pass --force to overwrite them without complaint. heads up: this one destroys files that are already there, so be sure bestie 😭
  • --outdir OUTDIR β€” Directory to write the output models into. If omitted, we write the output models to the same directory as the input models. put them wherever, she doesn't judge 🌸

πŸ‘‘ REPOSITORY πŸ‘‘

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

go star it, it's free and it's iconic ⭐


πŸ’– 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

and that's the whole page, bestie!! πŸ’…βœ¨ this was mrcal 2.5.2-4build1, dated 2026-03-20, coming at you straight from the MRCAL(1) manual. go convert something cute, ily, bye πŸ«ΆπŸ’–

πŸ“¦ where this page comes from