NAME
mrcal-calibrate-cameras - Calibrate some synchronized, stationary cameras
SYNOPSIS
$ mrcal-calibrate-cameras--corners-cache corners.vnl--lensmodel LENSMODEL_OPENCV8--focal 1700 --object-spacing 0.01 --object-width-n 10--outdir /tmp--pairs'left*.png' 'right*.png'... lots of output as the solve runs ...Done!RMS reprojection error: 1.9 pixelsWorst reprojection error: 7.8 pixelsNoutliers: 319 out of 17100 total points: 1.9% of the dataWrote /tmp/camera0-0.cameramodelWrote /tmp/camera0-1.cameramodel
DESCRIPTION
This tool uses the generic mrcal platform to solve a common specific problem of N-camera calibration using observations of a chessboard. Please see the mrcal documentation at <http://mrcal.secretsauce.net/how-to-calibrate.html> for details.
OPTIONS
POSITIONAL ARGUMENTS
images A glob-per-camera for the images. Include a glob foreach camera. It is assumed that the image filenames ineach glob are of of the form xxxNNNyyy where xxx andyyy are common to all images in the set, and NNNvaries. This NNN is a frame number, and identicalframe numbers across different globs signify a time-synchronized observation. I.e. you can pass'left*.jpg' and 'right*.jpg' to find images'left0.jpg', 'left1.jpg', ..., 'right0.jpg','right1.jpg', ...
OPTIONAL ARGUMENTS
-h, --help show this help message and exit--lensmodel LENSMODELWhich lens model we're using. This is a string"LENSMODEL_....". Required unless we have a --seed.See L<http://mrcal.secretsauce.net/how-to-calibrate.html>for notes about how to select a model--focal FOCAL Initial estimate of the focal length, in pixels.Required unless --seed is given. SeeL<http://mrcal.secretsauce.net/how-to-calibrate.html> fornotes about how to estimate a focal length. This iseither a single value to use for all the cameras, or acomma-separated whitespace-less list of values to usefor each camera. If such a list is given, it mustmatch the number of cameras being calibrated--imagersize IMAGERSIZE IMAGERSIZESize of the imager. This is only required if we pass--corners-cache AND if none of the image files on diskactually exist and if we don't have a --seed. If we dohave a --seed, the --imagersize values must match the--seed exactly--outdir OUTDIR Directory for the output camera models--object-spacing OBJECT_SPACINGWidth of each square in the calibration board, inmeters--object-width-n OBJECT_WIDTH_NHow many points the calibration board has perhorizontal side. If omitted we default to 10--object-height-n OBJECT_HEIGHT_NHow many points the calibration board has per verticalside. If omitted, we assume a square object, settingheight=width--seed SEED A comma-separated whitespace-less list of camera modelglobs to use as a seed for the intrinsics andextrinsics. The number of models must match the numberof cameras exactly. Expanded globs are sortedalphanumerically. This is useful to bootstrap thesolve or to validate an existing set of models, or torecompute just the extrinsics or just the intrinsicsof a solve. If omitted, we estimate a seed. Exclusivewith --focal. If given, --imagersize is omitted or itmust match EXACTLY with whatever is in the --seedmodels--jobs, -j JOBS How much parallelization we want. Like GNU make.Affects only the chessboard corner finder. If we arereading a cache file, this does nothing--corners-cache CORNERS_CACHEPath to the corner-finder results. If this fileexists, I use the corners in this file. If it doesn'texist, I invoke mrgingham to compute the corners, andI write the results to that path. And THEN I computethe calibration off those observations. This file is avnlog with legend "# filename x y level" (exactly whatmrgingham reports). Each rown is an observed corners.If an image had no observations, a single row"filename - - -" is expected. The "level" is thedecimation level used in detecting that corner. "0"means "full-resolution", "1" means "half-resolution","2" means "quarter-resolution" and so on. A level of"-" or <0 means "skip this point". This is howincomplete board observations are specified. A filewith a missing "level" column will fill in "0" for allcorners. A non-mrgingham grid detector may be used byrunning that separately, and using this option to readthe output. A detector may output weights instead of adecimation level in the last column. Pass --corners-cache-has-weights to interpret the data in that way--corners-cache-has-weightsBy default the corners we read in --corners-cache havecolumns "filename x y level". If the last column is aweight instead of a decimation level, pass thisoption. This is useful to support non-mrginghamchessboard detectors--pairs By default, we are calibrating a set of N independentcameras. If we actually have a number of stereo pairs,pass this argument. It changes the filename format ofthe models written to disk (cameraPAIR-INDEXINPAIR.cameramodel), and will report someuncertainties about geometry inside each pair.Consecutive cameras in the given list are paired up,and an even number of cameras is required--skip-regularizationBy default we apply regularization in the solver inthe final optimization. This discourages obviously-wrong solutions, but can introduce a bias. With thisoption, regularization isn't applied--skip-outlier-rejectionBy default we throw out outliers. This option turnsthat off--skip-extrinsics-solveKeep the seeded extrinsics, if given. Allowed only if--seed--skip-intrinsics-solveKeep the seeded intrinsics, if given. Allowed only if--seed--skip-calobject-warp-solveBy default we assume the calibration target isslightly deformed, and we compute this deformation. Ifwe want to assume that it is flat, pass this option.--valid-intrinsics-region-parameters VALID_INTRINSICS_REGION_PARAMETERS VALID_INTRINSICS_REGION_PARAMETERS VALID_INTRINSICS_REGION_PARAMETERS VALID_INTRINSICS_REGION_PARAMETERS VALID_INTRINSICS_REGION_PARAMETERSFor convenience we compute a valid-intrinsics regionto describe the results of the calibration. This is awatered-down interpretation of the projectionuncertainty that is easy to interpret. The logiccomputing this is somewhat crude, and may go away inthe future. The defaults should be reasonable, so ifin doubt, leave these alone. The intent is to produceusable output even if we're using a lean lens modelwhere the computed uncertainty is always overlyoptimistic. We bin the observations into a grid, anduse mrcal._report_regional_statistics() to get theresidual statistics in each bin. We then contour thebins to produce the valid-intrinsics region. If we'reusing a rich lens model (LENSMODEL_SPLINED_...), thenwe only look at the uncertainty, and not at the otherstatistics. This argument takes 5 parameters. Theuncertainty is computed at a rangevalid_intrinsics_region_parameters[4]. If <= 0, I lookout to infinity. The default is 0. A region is validonly if the projection uncertainty <valid_intrinsics_region_parameters[0] *observed_pixel_uncertainty. The default is 1. A regionis valid only if the mean-abs-residuals is <valid_intrinsics_region_parameters[1] (only for leanmodels). The default is 0.5. A region is valid only ifthe residuals stdev is <valid_intrinsics_region_parameters[2] *observed_pixel_uncertainty (only for lean models). Thedefault is 1.5. A region is valid only if it containsat least valid_intrinsics_region_parameters[3]observations (only for lean models). The default is 3.--verbose-solver By default the final stage of the solver doesn't saymuch. This option turns on verbosity to get lots ofdiagnostics. This is generally not very useful to endusers--explore After the solve open an interactive shell to examinethe solution
REPOSITORY
<https://www.github.com/dkogan/mrcal>
AUTHOR
Dima Kogan, "<[email protected]>"
LICENSE AND COPYRIGHT
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