Building or installing

I provide packages for a number of distros. If possible, please use these instead of building from source. If you're interested in packages for a not-yet-supported distro, please contribute! You can email me for help.

Installing from packages

Debian-based

As of today (2022-02-27), mrcal is included in the bleeding-edge versions of Debian and Ubuntu. So if you're running at least Debian/testing or the not-yet-published Debian 12 (bookworm) or Ubuntu 22.04 (jammy), you can simply

apt install mrcal libmrcal-dev python3-mrcal

to install the commandline tools and the C development library and the Python library respectively.

For older distros I currently distribute packages for

  • Debian/buster
  • Debian/bullseye
  • Ubuntu/jammy (22.04 LTS)
  • Ubuntu/focal (20.04 LTS)
  • Ubuntu/bionic (18.04 LTS)

To use these, add to your /etc/apt/sources.list:

deb [trusted=yes] http://mrcal.secretsauce.net/packages/DISTRO/public/ DISTRO main

where DISTRO is one of

  • buster
  • bulleye
  • jammy
  • focal
  • bionic

Then, apt update && apt install mrcal. The chessboard corner finder, while not strictly required, is needed if you're doing chessboard-based calibrations. apt install mrgingham

Building from source

If you cannot use the packages for whatever reason, you must build from source. This isn't difficult, but requires you to obtain all the dependencies. They're listed in the Build-Depends section of the debian package definition. Most of these are available in most distros. Things that may not be:

  • mrbuild: the build system. If you can't get it from the package manager, just run make, and follow the printed message to get a local copy of mrbuild.
  • libdogleg-dev: the optimization library. You need at least version 0.15.3.
  • vnlog: the toolkit to manipulate textual tables. You only need this for the test suite. There's nothing to build. Simply downloading the sources and pointing the PATH there is sufficient.
  • python3-numpysane: The make-numpy-reasonable library. You absolutely need at least version 0.35. Available in the usual places Python libraries live. This is a python-only library. Simply downloading the sources and pointing the PYTHONPATH there is sufficient.
  • python3-gnuplotlib: The plotting library used in all the visualizations. You need at least version 0.38. Available in the usual places Python libraries live. This is a python-only library. Simply downloading the sources and pointing the PYTHONPATH there is sufficient.
  • mrgingham: the chessboard corner finder. This isn't strictly a requirement - any corner finder can be used. If you want to use this one (and you can't use the packages), you need to build it.
  • re2c: parser-generator for the C code to parse .cameramodel files. At least version 2 is required.
  • python3-fltk: Python bindings for the FLTK GUI toolkit. Optional. Used only in the visualizer in the mrcal-stereo tool.
  • python3-gl-image-display: an image widget for FLTK. Optional. Used only in the visualizer in the mrcal-stereo tool.
  • libfreeimage-dev: an image reading/writing library. Most distros have this available.
  • libelas-dev: the ELAS stereo matcher. Used as an option in the mrcal-stereo tool. Optional.

Once these are all downloaded and built (where needed), we can talk about building mrcal. The build-time executables (re2c) must be found in the PATH, the Python libraries in PYTHONPATH, and the C headers and libraries must be findable via the flags in CFLAGS and LDFLAGS respectively. Anything that hasn't been installed to a standard location must be pointed to via the environment. So to build:

export PATH=$PATH:extra_path_to_executables
export PYTHONPATH=extra_path_to_python_libraries

CFLAGS=-Iextra_path_to_c_headers LDFLAGS="-Lextra_path_to_libraries -Wl,-rpath=extra_path_to_libraries" make

If everything has been installed to a standard location, you just run make without any of the extra stuff. The build should then complete successfully, and the test suite should pass:

make test-nosampling

If stuff doesn't work, feel free to bug me.