DisparityMapToElevationMap¶
Projects a disparity map into a regular elevation map.
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¶
Input and output data¶
This group of parameters allows one to set input images, output images and grids.
Input disparity map -io.in image
Mandatory
The input disparity map (horizontal disparity in first band, vertical in second). This map can be computed by BlockMatching application.
Left sensor image -io.left image
Mandatory
Left image in original (sensor) geometry. Only the geometric model of this image will be used, not the pixel values.
Right sensor image -io.right image
Mandatory
Right image in original (sensor) geometry. Only the geometric model of this image will be used, not the pixel values.
Left Grid -io.lgrid image
Mandatory
Left epipolar grid (deformation grid between left sensor et disparity spaces)
Right Grid -io.rgrid image
Mandatory
Right epipolar grid (deformation grid between right sensor et disparity spaces)
Output elevation map -io.out image [dtype]
Mandatory
Output elevation map in ground projection. Elevation values are in meters. Floating point pixel type are expected.
Disparity mask -io.mask image
Masked disparity pixels won’t be projected (mask values equal to zero)
DEM step -step float
Default value: 5
Spacing of the output elevation map (in meters)
Minimum elevation expected -hmin float
Default value: 0
Minimum elevation expected (in meters)
Maximum elevation expected -hmax float
Default value: 100
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 -elev.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 -elev.geoid filename [dtype]
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 -elev.default float
Default value: 0
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) -ram int
Default value: 256
Available memory for processing (in MB).
Examples¶
From the command-line:
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
From Python:
import otbApplication
app = otbApplication.Registry.CreateApplication("DisparityMapToElevationMap")
app.SetParameterString("io.in", "disparity.tif")
app.SetParameterString("io.left", "sensor_left.tif")
app.SetParameterString("io.right", "sensor_right.tif")
app.SetParameterString("io.lgrid", "grid_epi_left.tif")
app.SetParameterString("io.rgrid", "grid_epi_right.tif")
app.SetParameterString("io.out", "dem.tif")
app.ExecuteAndWriteOutput()
Limitations¶
The epipolar deformation grid should be able to entirely fit in memory.