MRCAL(1)

πŸ’– MRCAL(1) β€” mrcal: camera projection, calibration toolkit πŸ’–

okay bestie, sit DOWN, because this is mrcal-show-distortion-off-pinhole from the mrcal toolkit, and it's literally about to show you what your lens model is actually doing. no cap. πŸ¦‹


✨ NAME ✨

mrcal-show-distortion-off-pinhole β€” visualize the behavior of a lens model πŸ‘‘ (yes that's the whole name, she's long but she's worth it)


🌈 SYNOPSIS 🌈

$ mrcal-show-distortion-off-pinhole --vectorfield left.cameramodel

... a plot pops up showing the vector field of the difference from a pinhole
projection

πŸŽ€ DESCRIPTION πŸŽ€

So like, this tool exists to examine how a lens model behaves. That's the whole vibe. Depending on the model, the vectors could be very large or very small, and if they're tiny and sad you can scale them by passing --vectorscale s. By default we sample in a 60x40 grid, but bestie, you can control that spacing by passing --gridn w h. πŸ’…

By default we render a heat map</> of the lens effects. You can also see the vectorfield by passing in --vectorfield. Or, alternate flavor, you can see the radial distortion curve by passing --radial. Pick your fighter. ✨

This tool treats a pinhole projection as a baseline, and visualizes deviations from this baseline. So wide lenses will have a LOT of reported "distortion". Which means pinhole models aren't a good baseline, lowkey. BUT β€” and here's the plot twist β€” pretty much every non-mrcal tool in common use treats lenses as pinhole+distortion, and that's exactly what makes this visualization useful. iykyk. 🫢

The plots produced with --radial show the magnitude of the radial distortion as a function of the distance to the center. For opencv models the radial distortion is plotted directly from the projection equations: these represent radial distortion explicitly. For other models, we empirically sample the imager from the optical center given by intrinsics[2:4] to the 4 corners and the 4 centers of the imager edges. πŸ“

Note that the splined models often shift the projection center from intrinsics[2:4], causing unnatural-looking curves near the center. This isn't a a bug: intrinsics[2:4] isn't really in the center, which isn't a problem for anything except this visualization. πŸ’€ (not me getting jump-scared by a curve that was fine the whole time)

✨ OPTIONS ✨

🌸 POSITIONAL ARGUMENTS 🌸

  • model β€” Input camera model. If - is given, we read standard input. (yes queen, piped-in models are valid)

πŸ¦‹ OPTIONAL ARGUMENTS πŸ¦‹

  • -h, --help β€” show this help message and exit
  • --gridn GRIDN GRIDN β€” How densely we should sample the imager. By default we report a 60x40 grid
  • --vectorscale VECTORSCALE β€” Scale the vectors by this factor. Default is 1.0 (report the truth), but this is often too small to see πŸ‘€
  • --radial β€” Show the radial distortion scale factor instead of a colormap/vectorfield
  • --vectorfield β€” Plot the diff as a vector field instead of as a heat map. The vector field contains more information (magnitude AND direction), but is less clear at a glance. (ngl it's giving "more data, more confusion" and we respect it)
  • --show-fisheye-projections β€” Applies to radial plots only. if given, the radial plots include the behavior of common fisheye projections, in addition to the behavior of THIS lens 🐟
  • --cbmax CBMAX β€” Maximum range of the colorbar
  • --title TITLE β€” Title string for the plot. Overrides the default title. Exclusive with --extratitle βš”οΈ
  • --extratitle EXTRATITLE β€” Additional string for the plot to append to the default title. Exclusive with --title βš”οΈ
  • --hardcopy HARDCOPY β€” Write the output to disk, instead of making an interactive plot
  • --terminal TERMINAL β€” gnuplotlib terminal. The default is good almost always, so most people don't need this option
  • --set SET β€” Extra set directives to pass to gnuplotlib. May be given multiple times
  • --unset UNSET β€” Extra unset directives to pass to gnuplotlib. May be given multiple times

🌟 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 page bestie, you're officially calibrated πŸ’–βœ¨ this was mrcal 2.5.2-4build1, dated 2026-03-20, and it's still MRCAL(1) energy through and through. go plot something iconic. πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from