NAME

mrcal-show-projection-diff - Visualize the difference in projection between N models

SYNOPSIS

$ mrcal-show-projection-diff before.cameramodel after.cameramodel
... a plot pops up showing how these two models differ in their projections

DESCRIPTION

The operation of this tool is documented at http://mrcal.secretsauce.net/differencing.html

This tool visualizes the results of mrcal.projection_diff()

It is often useful to compare the projection behavior of two camera models. For instance, one may want to validate a calibration by comparing the results of two different chessboard dances. Or one may want to evaluate the stability of the intrinsics in response to mechanical or thermal stresses. This tool makes these comparisons, and produces a visualization of the results.

In the most common case we're given exactly 2 models to compare. We then display the projection difference as either a vector field or a heat map. If we're given more than 2 models, then a vector field isn't possible and we instead display as a heatmap the standard deviation of the differences between models 1..N and model0.

The top-level operation of this tool:

- Grid the imager - Unproject each point in the grid using one camera model - Apply a transformation to map this point from one camera's coord system to the other. How we obtain this transformation is described below - Project the transformed points to the other camera - Look at the resulting pixel difference in the reprojection

Several arguments control how we obtain the transformation. Top-level logic:

if --intrinsics-only:
    Rt10 = identity_Rt()
else:
    if --radius 0:
        Rt10 = relative_extrinsics(models)
    else:
        Rt10 = implied_Rt10__from_unprojections()

The details of how the comparison is computed, and the meaning of

OPTIONS

THE ARGUMENTS

controlling this, are in the docstring of mrcal.projection_diff().

POSITIONAL ARGUMENTS

models                Camera models to diff

OPTIONAL ARGUMENTS

-h, --help            show this help message and exit
--gridn GRIDN GRIDN   How densely we should sample the imager. By default we
                      use a 60x40 grid
--distance DISTANCE   Has an effect only without --intrinsics-only. The
                      projection difference varies depending on the range to
                      the observed world points, with the queried range set
                      in this argument. If omitted we look out to infinity.
                      We can also fit multiple distances at the same time by
                      passing them here in a comma-separated, whitespace-
                      less list. If multiple distances are given, we fit the
                      implied-by-the-intrinsics transformation using ALL the
                      distances, but we display the difference for the FIRST
                      distance given. Only one distance is supported if
                      --vectorfield. Multiple distances are especially
                      useful if we have uncertainties: the most confident
                      distance will be found, and displayed.
--intrinsics-only     If given, we evaluate the intrinsics of each lens in
                      isolation by assuming that the coordinate systems of
                      each camera line up exactly
--where WHERE WHERE   Center of the region of interest for this diff. Used
                      only without --intrinsics-only and without "--radius
                      0". 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
--radius RADIUS       Radius of the region of interest. If ==0, we do NOT
                      fit an implied transformation at all, but use the
                      transformations in the models. If omitted or <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
--observations        If given, I show where the chessboard corners were
                      observed at calibration time. These should correspond
                      to the low-diff regions.
--valid-intrinsics-region
                      If given, I overlay the valid-intrinsics regions onto
                      the plot
--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
--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
--vectorscale VECTORSCALE
                      If plotting a vectorfield, scale all the vectors by
                      this factor. Useful to improve legibility if the
                      vectors are too small to see
--directions          If given, the plots are color-coded by the direction
                      of the error, instead of the magnitude
--no-uncertainties    Used only without --intrinsics-only and without "--
                      radius 0". 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
--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 gnuplotlib. Can be given
                      multiple times
--unset UNSET         Extra 'unset' directives to gnuplotlib. Can be given
                      multiple times

REPOSITORY

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

AUTHOR

Dima Kogan, <dima@secretsauce.net>

LICENSE AND COPYRIGHT

Copyright (c) 2017-2021 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