MRCAL(1)

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

🌸 MRCAL(1) β€” mrcal: camera projection, calibration toolkit 🌸

okay bestie, welcome to the mrcal-from-ros page πŸ’– (that's the manual for section 1, MRCAL, iykyk). it's a lil tool that eats ROS/OpenCV camera models and spits out .cameramodel files. no glow-up, no makeover β€” just a format glow-transfer. let's go ✨


πŸŽ€ NAME πŸŽ€

mrcal-from-ros β€” literally just converts a ROS/OpenCV-formatted camera model into the .cameramodel file format. that's it, that's the whole job, and she does it flawlessly πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

like. picture this. you have a yaml. it's giving very OpenCV:

$ cat model1.yaml

image_width: 2448
image_height: 2050
camera_name: prosilica
camera_matrix:
  rows: 3
  cols: 3
  data: [4827.94, 0, 1223.5, 0, 4835.62, 1024.5, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.41527, 0.31874, -0.00197, 0.00071, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [4827.94, 0, 1223.5, 0, 0, 4835.62, 1024.5, 0, 0, 0, 1, 0]

and then you hit her with the classic:

$ mrcal-from-ros model1.yaml model2.yaml

Wrote model1.cameramodel
Wrote model2.cameramodel

and boom πŸ’₯ now you got this:

$ cat model1.cameramodel

{
    'lensmodel':  'LENSMODEL_OPENCV5',

    # intrinsics are fx,fy,cx,cy,distortion0,distortion1,....
    'intrinsics': [ 4827.94, 4835.62, 1223.5, 1024.5, -0.41527, 0.31874, -0.00197, 0.00071, 0,],

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

    'imagersize': [ 2448, 2050,],
}

and if you're feeling ✨pipeline✨ energy, she reads from stdin too:

$ rostopic echo -n1 -b tst.bag /camera/camera_info \
  | head -n -1                                     \
  | mrcal-from-ros                                 \
  > model.cameramodel

not me piping rosbag topics straight into a cameramodel 😭 iconic behavior fr fr


✨ DESCRIPTION ✨

the file formats mrcal supports are all written down over here, go look:

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

so like, what does this tool actually do? it takes the model(s) you hand it and converts them to the cameramodel file format. no changes to the content are made β€” bestie, she is purely a format converter 🫢. she does not fit anything, she does not remix, she does not pick a different lens model. (that's a whole different girl: the mrcal-convert-lensmodel tool, which actually fits different lens models. know the difference πŸ’…)

you give her model filenames on the commandline. output gets written to the same directory, with the same filename, but with a .cameramodel extension. slay.

if the model is omitted, or you literally just pass "-", then the input is read from standard input and the output is written to standard output. very stdin/stdout of her 🌈

note: there's no corresponding mrcal-to-ros tool at this time, because the behavior of such a tool isn't well-defined. talk to me if this would be useful to you, so we can clarify what it should do, exactly. πŸ‘€ (yes that's a real invitation, come say hi)

πŸ‘‘ OPTIONS πŸ‘‘

πŸ“ POSITIONAL ARGUMENTS

  • model β€” the input camera model. hand it over, bestie πŸ’–

🌸 OPTIONAL ARGUMENTS

  • -h, --help β€” show this help message and exit. the "wait what does this do again" button ✨
  • --force, -f β€” by default, existing files are not overwritten. pass --force to overwrite them without complaint. no questions asked, no warnings, she just goes πŸ’€
  • --outdir OUTDIR β€” directory to write the output models into. if omitted, we write the output models to the same directory as the input models. very "where do you want it" energy πŸ“

πŸ’œ REPOSITORY πŸ’œ

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

come through, star the repo, it's giving main character energy ⭐


🧚 AUTHOR 🧚

Dima Kogan, "<dima@secretsauce.net>" β€” the icon, the legend, the moment πŸ‘‘


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 page, you're officially fluent in mrcal-from-ros πŸ¦‹ this was mrcal 2.5.2-4build1, dated 2026-03-20, and it lives in manual section MRCAL(1). go convert something cute, bestie πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from