DisparityMapToElevationMap - Disparity map to elevation map

Projects a disparity map into a regular elevation map.

Detailed description

This application uses a disparity map computed from a stereo image pair to produce an elevation map on the ground area covered by the stereo pair.

This application is part of the stereo reconstruction pipeline. It can be used after having computed the disparity map with BlockMatching.

The needed inputs are
: the disparity map, the stereo pair (in original geometry) and the epipolar deformation grids. These grids (computed by StereoRectificationGridGenerator) have to contain the transform between the original geometry (stereo pair) and the epipolar geometry (disparity map). The algorithm for each disparity is the following :
  • skip if position is discarded by the disparity mask
  • compute left ray : transform the current position from epipolar geometry to left sensor geometry (left rectification grid)
  • compute right ray : shift the current position with current disparity and transform from epipolar geometry to right sensor (right rectification grid)
  • estimate best 3D intersection between left and right rays
  • for the ground cell of the obtained 3D point, keep its elevation if greater than current elevation (keeps the maximum of elevations of all 3D points in each cell)

Minimum and maximum elevations settings are here to bound the reconstructed DEM.

Parameters

This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is DisparityMapToElevationMap .

[1]Table: Parameters table for Disparity map to elevation map.
Parameter Key Parameter Name Parameter Type
io Input and output data Group
io.in Input disparity map Input image
io.left Left sensor image Input image
io.right Right sensor image Input image
io.lgrid Left Grid Input image
io.rgrid Right Grid Input image
io.out Output elevation map Output image
io.mask Disparity mask Input image
step DEM step Float
hmin Minimum elevation expected Float
hmax Maximum elevation expected Float
elev Elevation management Group
elev.dem DEM directory Directory
elev.geoid Geoid File Input File name
elev.default Default elevation Float
ram Available RAM (Mb) Int
inxml Load otb application from xml file XML input parameters file
outxml Save otb application to xml file XML output parameters file

[Input and output data]: This group of parameters allows one to set input images, output images and grids.

  • Input disparity map: The input disparity map (horizontal disparity in first band, vertical in second). This map can be computed by BlockMatching application.
  • Left sensor image: Left image in original (sensor) geometry. Only the geometric model of this image will be used, not the pixel values.
  • Right sensor image: Right image in original (sensor) geometry. Only the geometric model of this image will be used, not the pixel values.
  • Left Grid: Left epipolar grid (deformation grid between left sensor et disparity spaces).
  • Right Grid: Right epipolar grid (deformation grid between right sensor et disparity spaces).
  • Output elevation map: Output elevation map in ground projection. Elevation values are in meters. Floating point pixel type are expected.
  • Disparity mask: Masked disparity pixels won’t be projected (mask values equal to zero).

DEM step: Spacing of the output elevation map (in meters).

Minimum elevation expected: Minimum elevation expected (in meters).

Maximum elevation expected: Maximum elevation expected (in meters).

[Elevation management]: This group of parameters allows managing elevation values. Supported formats are SRTM, DTED or any geotiff. DownloadSRTMTiles application could be a useful tool to list/download tiles related to a product.

  • DEM directory: This parameter allows selecting a directory containing Digital Elevation Model files. Note that this directory should contain only DEM files. Unexpected behaviour might occurs if other images are found in this directory.
  • Geoid File: Use a geoid grid to get the height above the ellipsoid in case there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles. A version of the geoid can be found on the OTB website(https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data/blob/master/Input/DEM/egm96.grd).
  • Default elevation: This parameter allows setting the default height above ellipsoid when there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles, and no geoid file has been set. This is also used by some application as an average elevation value.

Available RAM (Mb): Available memory for processing (in MB).

Load otb application from xml file: Load otb application from xml file.

Save otb application to xml file: Save otb application to xml file.

Example

To run this example in command-line, use the following:

otbcli_DisparityMapToElevationMap -io.in disparity.tif -io.left sensor_left.tif -io.right sensor_right.tif -io.lgrid grid_epi_left.tif -io.rgrid grid_epi_right.tif -io.out dem.tif

To run this example from Python, use the following code snippet:

#!/usr/bin/python

# Import the otb applications package
import otbApplication

# The following line creates an instance of the DisparityMapToElevationMap application
DisparityMapToElevationMap = otbApplication.Registry.CreateApplication("DisparityMapToElevationMap")

# The following lines set all the application parameters:
DisparityMapToElevationMap.SetParameterString("io.in", "disparity.tif")

DisparityMapToElevationMap.SetParameterString("io.left", "sensor_left.tif")

DisparityMapToElevationMap.SetParameterString("io.right", "sensor_right.tif")

DisparityMapToElevationMap.SetParameterString("io.lgrid", "grid_epi_left.tif")

DisparityMapToElevationMap.SetParameterString("io.rgrid", "grid_epi_right.tif")

DisparityMapToElevationMap.SetParameterString("io.out", "dem.tif")

# The following line execute the application
DisparityMapToElevationMap.ExecuteAndWriteOutput()

Limitations

The epipolar deformation grid should be able to entirely fit in memory.

Authors

This application has been written by OTB-Team.

See Also

These additional resources can be useful for further information:
[1] StereoRectificationGridGenerator
[2] BlockMatching