VPI - Vision Programming Interface

0.3.7 Release

Stereo Disparity Estimator

Overview

Given a pair of rectified images from a stereo camera, the Stereo Disparity algorithm uses high-quality dense stereo matching to produce an output image of the same resolution as the input with left-right disparity information. This allows for inferring the depth of the scene captured by the left and right images.

Left imageRight image
Disparity map

Implementation

The stereo disparity estimator uses semi-global matching algorithm to compute the disparity. We deviate from the original algorithm by using as cost function the hamming distance of the census transforms of the stereo pair.

Usage

  1. Initialization phase
    1. Include the header that defines the needed functions and structures.
    2. Define the stream on which the algorithm will be executed, the input stereo pair, composed of two images, and the output disparity image.
      VPIStream stream = /*...*/;
      VPIImage left = /*...*/;
      VPIImage right = /*...*/;
    3. Create the payload that will contain all temporary buffers needed for processing.
      VPIPayload stereo;
      vpiCreateStereoDisparityEstimator(stream, 480, 270, VPI_IMAGE_TYPE_Y16, 64, &stereo);
  2. Processing phase
    1. Define the configuration parameters needed for algorithm execution.
      params.windowSize = 5;
      params.maxDisparity = 64;
    2. Submit the payload for execution on the stream associated with it.
      vpiSubmitStereoDisparityEstimator(stereo, left, right, disparity, &params);
    3. Optionally, wait until the processing is done.
      vpiStreamSync(stream);
  3. Cleanup phase
    1. Free resources held by the payload.

Consult the Stereo Disparity Sample for a complete example.

For more details, consult the API reference.

Limitations and Constraints

Constraints for specific backends superceed the ones specified for all backends.

All Backends

  • Left and right input images must have same type and dimensions.
  • Output image dimensions must match input's.
  • Output disparity images must have type VPI_IMAGE_TYPE_U16.
  • Maximum disparity parameter passed to algorithm submission must be the same as defined during payload creation.
  • Input image dimensions must match what is defined during payload creation.

CUDA and CPU

PVA

  • Left and right accepted input image types:
  • Input and output image dimensions must be 480x270.
  • windowSize must be 5.
  • maxDisparity must be 64.

Performance

For further information on how how performance benchmarked, see Performance Measurement.

Jetson AGX Xavier
sizetypemax
disp.
CPUCUDAPVA
480x270u864 365 ms5.770 msn/a
480x270u832 206 ms6.926 msn/a
480x270u1664 357 ms5.823 ms14.336 ms
480x270u1632 206.9 ms7.0159 msn/a
Jetson TX2
sizetypemax
disp.
CPUCUDAPVA
480x270u864 1010 ms23.06 msn/a
480x270u832 483.0 ms25.2 msn/a
480x270u1664 1002 ms23.2 msn/a
480x270u1632 484.5 ms25.1 msn/a
Jetson Nano
sizetypemax
disp.
CPUCUDAPVA
480x270u864 1791 ms54.88 msn/a
480x270u832 863 ms51.3 msn/a
480x270u1664 1795 ms54.73 msn/a
480x270u1632 867 ms51.3 msn/a

References

  • Hirschmüller, Heiko (2005). "Accurate and efficient stereo processing by semi-global matching and mutual information".
    IEEE Conference on Computer Vision and Pattern Recognition. pp. 807–814.
  • Zabih, Ramin; Woodfill, John (1994). "Non-parametric local transforms for computing visual correspondence".
    European conference on computer vision. pp. 151–158.
vpiCreateStereoDisparityEstimator
VPIStatus vpiCreateStereoDisparityEstimator(VPIStream stream, uint32_t imageWidth, uint32_t imageHeight, const VPIImageType inputType, const uint32_t maxDisparity, VPIPayload *payload)
Creates payload for vpiSubmitStereoDisparityEstimator.
vpiPayloadDestroy
void vpiPayloadDestroy(VPIPayload payload)
Deallocates the payload object and all associated resources.
vpiStreamSync
VPIStatus vpiStreamSync(VPIStream stream)
Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty)...
VPIStream
struct VPIStreamImpl * VPIStream
A handle to a stream.
Definition: Types.h:177
vpiSubmitStereoDisparityEstimator
VPIStatus vpiSubmitStereoDisparityEstimator(VPIPayload payload, VPIImage left, VPIImage right, VPIImage disparity, const VPIStereoDisparityEstimatorParams *params)
Runs stereo processing on a pair of images, outputs a disparity map.
StereoDisparityEstimator.h
VPIStereoDisparityEstimatorParams::windowSize
uint32_t windowSize
width of Census Transform window for disparity features.
Definition: StereoDisparityEstimator.h:82
VPIImage
struct VPIImageImpl * VPIImage
A handle to an image.
Definition: Types.h:183
VPIPayload
struct VPIPayloadImpl * VPIPayload
A handle to an algorithm payload.
Definition: Types.h:195
VPIStereoDisparityEstimatorParams::maxDisparity
uint32_t maxDisparity
Maximum disparity for matching search.
Definition: StereoDisparityEstimator.h:83
VPIStereoDisparityEstimatorParams
Structure that defines the parameters for vpiCreateStereoDisparityEstimator.
Definition: StereoDisparityEstimator.h:81
VPI_IMAGE_TYPE_Y16
@ VPI_IMAGE_TYPE_Y16
Definition: Types.h:223