NAME
mrcal-stereo - Stereo processing
SYNOPSIS
$ mrcal-stereo \--az-fov-deg 90 \--el-fov-deg 70 \--pixels-per-deg -0.5 \--disparity-range 0 100 \--sgbm-block-size 5 \--sgbm-p1 600 \--sgbm-p2 2400 \--sgbm-uniqueness-ratio 5 \--sgbm-disp12-max-diff 1 \--sgbm-speckle-window-size 200 \--sgbm-speckle-range 2 \--outdir /tmp \left.cameramodel right.cameramodel \left.jpg right.jpgProcessing left.jpg and right.jpgWrote '/tmp/rectified0.cameramodel'Wrote '/tmp/rectified1.cameramodel'Wrote '/tmp/left-rectified.png'Wrote '/tmp/right-rectified.png'Wrote '/tmp/left-disparity.png'Wrote '/tmp/left-range.png'Wrote '/tmp/points-cam0.vnl'
DESCRIPTION
Given a pair of calibrated cameras and pairs of images captured by these cameras, this tool runs the whole stereo processing sequence to produce disparity and range images and a point cloud array.
mrcal functions are used to construct the rectified system. Currently only the OpenCV SGBM routine is available to perform stereo matching, but more
OPTIONS
OPTIONAL ARGUMENTS
will be made available with time.
OPTIONAL ARGUMENTS
-h, --help show this help message and exit--az-fov-deg AZ_FOV_DEGThe field of view in the azimuth direction, indegrees. There's no auto-detection at this time, sothis argument is required (unless --already-rectified)--el-fov-deg EL_FOV_DEGThe field of view in the elevation direction, indegrees. There's no auto-detection at this time, sothis argument is required (unless --already-rectified)--az0-deg AZ0_DEG The azimuth center of the rectified images. "0" means"the horizontal center of the rectified system is themean forward direction of the two cameras projected tolie perpendicular to the baseline". If omitted, wealign the center of the rectified system with thecenter of the two cameras' views--el0-deg EL0_DEG The elevation center of the rectified system. "0"means "the vertical center of the rectified systemlies along the mean forward direction of the twocameras" Defaults to 0.--pixels-per-deg PIXELS_PER_DEGThe resolution of the rectified images. This is eithera whitespace-less, comma-separated list of two values(az,el) or a single value to be applied to both axes.If a resolution of >0 is requested, the value is usedas is. If a resolution of <0 is requested, we use thisas a scale factor on the resolution of the first inputimage. For instance, to downsample by a factor of 2,pass -0.5. By default, we use -1 for both axes: theresolution of the input image at the center of therectified system.--rectification {LENSMODEL_PINHOLE,LENSMODEL_LATLON}The lens model to use for rectification. Currently twomodels are supported: LENSMODEL_LATLON (the default)and LENSMODEL_PINHOLE. Pinhole stereo works badly forwide lenses and suffers from varying angularresolution across the image. LENSMODEL_LATLONrectification uses a transverse equirectangularprojection, and does not suffer from these effects. Itis thus the recommended model--already-rectified If given, assume the given models and images alreadyrepresent a rectified system. This will be checked,and the models will be used as-is if the checks pass--clahe If given, apply CLAHE equalization to the images priorto the stereo matching. If --already-rectified, westill apply this equalization, if requested. Requires--force-grayscale--force-grayscale If given, convert the images to grayscale prior todoing anything else with them. By default, read theimages in their default format, and pass thoseposibly-color images to all the processing steps.Required if --clahe--viz {geometry,stereo}If given, we visualize either the rectified geometryor the stereo results. If --viz geometry: we constructthe rectified stereo system, but instead of continuingwith the stereo processing, we render the geometry ofthe stereo world; the images are ignored in this mode.If --viz stereo: we launch an interactive graphicaltool to examine the rectification and stereo matchingresults; the Fl_Gl_Image_Widget Python library must beavailable--axis-scale AXIS_SCALEUsed if --viz geometry. Scale for the camera axes. Bydefault a reasonable default is chosen (seemrcal.show_geometry() for the logic)--title TITLE Used if --viz geometry. Title string for the plot--hardcopy HARDCOPY Used if --viz geometry. Write the output to disk,instead of making an interactive plot. The outputfilename is given in the option--terminal TERMINAL Used if --viz geometry. The gnuplotlib terminal. Thedefault is almost always right, so most people don'tneed this option--set SET Used if --viz geometry. Extra 'set' directives to passto gnuplotlib. May be given multiple times--unset UNSET Used if --viz geometry. Extra 'unset' directives topass to gnuplotlib. May be given multiple times--force, -f By default existing files are not overwritten. Pass--force to overwrite them without complaint--outdir OUTDIR Directory to write the output into. If omitted, weuser the current directory--tag TAG String to use in the output filenames. Non-specificoutput filenames if omitted--disparity-range DISPARITY_RANGE DISPARITY_RANGEThe disparity limits to use in the search, in pixels.Two integers are expected: MIN_DISPARITYMAX_DISPARITY. Completely arbitrarily, we default toMIN_DISPARITY=0 and MAX_DISPARITY=100--valid-intrinsics-regionIf given, annotate the image with its valid-intrinsicsregion. This will end up in the rectified images, andmake it clear where successful matching shouldn't beexpected--range-image-limits RANGE_IMAGE_LIMITS RANGE_IMAGE_LIMITSThe nearest,furthest range to encode in the rangeimage. Defaults to 1,1000, arbitrarily--stereo-matcher {SGBM,ELAS}The stereo-matching method. By default we use the"SGBM" method from OpenCV. libelas isn't alwaysavailable, and must be enabled at compile-time bysetting USE_LIBELAS=1 during the build--sgbm-block-size SGBM_BLOCK_SIZEA parameter for the OpenCV SGBM matcher. If omitted, 5is used--sgbm-p1 SGBM_P1 A parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-p2 SGBM_P2 A parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-disp12-max-diff SGBM_DISP12_MAX_DIFFA parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-pre-filter-cap SGBM_PRE_FILTER_CAPA parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-uniqueness-ratio SGBM_UNIQUENESS_RATIOA parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-speckle-window-size SGBM_SPECKLE_WINDOW_SIZEA parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-speckle-range SGBM_SPECKLE_RANGEA parameter for the OpenCV SGBM matcher. If omitted,the OpenCV default is used--sgbm-mode {SGBM,HH,HH4,SGBM_3WAY}A parameter for the OpenCV SGBM matcher. Must be oneof ('SGBM','HH','HH4','SGBM_3WAY'). If omitted, theOpenCV default (SGBM) is used--write-point-cloud If given, we write out the point cloud as a .ply file.Each point is reported in the reference coordinatesystem, colored with the nearest-neighbor color of thecamera0 image. This is disabled by default becausethis is potentially a very large file--jobs, -j JOBS parallelize the processing JOBS-ways. This is likeMake, except you're required to explicitly specify ajob count. This applies when processing multiple setsof images with the same set of models
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