mrcal 2.0 release notes
New in mrcal 2.0
Lots and lots of under-the-hood improvements and bug fixes. Most notable ones listed here
High level significant improvements
- Reworked the dense stereo processing. This is now documented, with nice APIs.
Rectified models can be represented in a
.cameramodelfile, and saved to disk. - Added sparse triangulation routines. Uncertainty can be propagated through these routines to gauge the effects of calibration-time and observation-time noise.
LENSMODEL_SPLINED_STEREOGRAPHICmodels have been thoroughly tested, and are ready for prime time. Solver now applies anisotropic regularization to reduce curl in the correction vector field, so the solved models now act mostly radially. Themrcal-show-splined-model-correctiontool extended, and produces clearer plots. These models work well. Use them.- The
observed_pixel_uncertaintyis now estimated from the optimized residuals instead of being specified explicitly. The reported uncertainties should now be correct in absolute, not just relative terms mrcal.unproject()can report gradientsCalibration residuals can be visualized from the stored cameramodel, not just from
mrcal-calibrate-cameras --explore. Added new toolsand new Python API functions
.cameramodelfiles can be read/written from CAdded simple projection/unprojection functions to the Python and C APIs:
mrcal.project_pinhole()mrcal.unproject_pinhole()mrcal.project_latlon()mrcal.unproject_latlon()mrcal.project_lonlat()mrcal.unproject_lonlat()
This is added to the existing functions
- Added
LENSMODEL_LATLONandLENSMODEL_LONLATmodels to represent epipolar-aligned and panoramic images respectively
Lower-level improvements for user convenience and/or internal machinery
- All Python
poseutilsfunctions can now work in-place - Added
mrcal.invert_R()function mrcal.transform_point_Rt()andmrcal.rotate_point_R()can take aninvertedargumentmrcal.project_stereographic()andmrcal.unproject_stereographic()and the others now usenumpysane_pywrap, so full broadcasting and in-place output are available- Added
mrcal.num_states(),mrcal.num_intrinsics_optimization_params() - New lensmodel metadata property:
has_gradients. Currently onlyLENSMODEL_CAHVOREhas this atFalse mrcal.transform_image()supports more of the opencv api, like inplace outputmrcal-reproject-imagetool has new--distanceargumentmrcal-show-....visualization tools (andmrcal.show_...()functions) have new--title(andtitle) argument. These replace the default title instead of extending the default, which--extratitledoesmrcal.projection_uncertainty()function can takeobserved_pixel_uncertaintyargument, to override the value inferred from the residuals at the optimum- The visualization functions can plot observations with dots instead of points:
- Added
mrcal.fitted_gaussian_equation()
Migration notes 1.0 -> 2.0
mrcal is being actively developed, and some improvements change the interfaces in incompatible ways, requiring small amounts of work to port older code. I try to avoid breaking changes, but sometimes doing this is necessary. The C API is mostly unstable. If you use the mrcal C library, read this section carefully. The Python API and the commandline tools are mostly stable, but some things did change, so please still read this section.
- The
observed_pixel_uncertaintyis now estimated from the optimized residuals instead of being specified explicitly.mrcal_optimize()andmrcal_optimizer_callback()in the C API don't have this argument anymore. The Python analoguesmrcal.optimize()andmrcal.optimizer_callback()still accept the argument (to keep old.cameramodelfiles working), but this argument is now ignored seed_pinhole()function reworked and renamed tomrcal.seed_stereographic()mrcal.transform_image()API extended. Calls are backwards-compatible, but the defaults have changedshow_splined_model_surface()function renamed tomrcal.show_splined_model_correction(). Similarly, Themrcal-show-splined-model-surfacetool renamed tomrcal-show-splined-model-correction. New function and tool can display the data in new ways (the correction vector field and correction magnitude), and the defaults have changedmrcal-show-distortion-off-pinholecmdline tool:--scaleargument renamed to--vectorscalefor consistencymrcal.show_distortion_off_pinhole(): radial functionality split intomrcal.show_distortion_off_pinhole_radial()mrcal.show_projection_uncertainty_xydist()was removed. It wasn't usefulLENSMODEL_CAHVORElens models:linearityis a configuration parameter, not an optimization parameter. All existing.cameramodelfiles containingLENSMODEL_CAHVOREmodels must be ported. I doubt there's a single one of those out there.mrcal.hypothesis_corner_positions()renamed tomrcal.hypothesis_board_corner_positions()and the API was updated in a breaking waymrcal.lensmodel_metadata()renamed tomrcal.lensmodel_metadata_and_config()All the existing stereo processing functions were redone. Calls to
mrcal.stereo_rectify_prepare()mrcal.stereo_unproject()mrcal.stereo_range()mrcal.stereo_range()
must be ported. See the documentation for the new functions.
- -
mrcal_transform_point_Rt()andmrcal_rotate_point_R()C functions now take aninvertedargument. This is an API, ABI break mrcal.synthesize_board_observations()returnsRt_ref_boardref, notRt_cam0_boardref. The API didn't change, but the meaning of the output didmrcal_project_...()andmrcal_unproject_...()functions now takeconst double* fxycxyinstead of 4 discretedoublevalues- Similarly, the
mrcal.project_...()andmrcal.unproject_...()functions now take anfxycxyarray instead of 4 discrete values mrcal_state_index_THING()andmrcal_num_states_THING()(and their Python flavors) return <0 and 0 respectively in C (and None and 0 respectively in Python) in case the THING isn't actually being optimizedmrcal-show-geometrytool:--scale-axesargument renamed to--axis-scalemrcal-show-valid-intrinsics-regiontool:--writeimagerenamed to--write-imagemrcal.apply_color_map()uses BGR, not RGBmrcal.image_transformation_map(): API extended in non-backwards-compatible way- Some tools, functions have more consistent, better arguments at the expense of breaking the API:
mrcal-show-geometrytool: default is flipped, so--hide-boardsoption was removed and a--show-calobjectsoption addedmrcal.synthesize_board_observations()uses different strings for thewhichargument:_->-