VPI - Vision Programming Interface

0.2.0 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.

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 362 ms5.8191 msn/a
480x270u832 205 ms6.988 msn/a
480x270u1664 360 ms5.8635 ms14.274 ms
480x270u1632 205 ms7.095 msn/a
Jetson TX2
sizetypemax
disp.
CPUCUDAPVA
480x270u864 989 ms23.0 msn/a
480x270u832 506 ms25.3 msn/a
480x270u1664 1037 ms23.6 msn/a
480x270u1632 508.1 ms25.28 msn/a
Jetson Nano
sizetypemax
disp.
CPUCUDAPVA
480x270u864 1791 ms54.66 msn/a
480x270u832 860 ms51.26 msn/a
480x270u1664 1792 ms54.86 msn/a
480x270u1632 863 ms51.62 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.
vpiStreamSync
VPIStatus vpiStreamSync(VPIStream stream)
Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty)...
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
VPI_IMAGE_TYPE_Y16
@ VPI_IMAGE_TYPE_Y16
Definition: Types.h:207
VPIStereoDisparityEstimatorParams::windowSize
uint32_t windowSize
width of Census Transform window for disparity features.
Definition: StereoDisparityEstimator.h:82
VPIImage
struct VPIImageImpl * VPIImage
Definition: Types.h:170
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
VPIPayload
struct VPIPayloadImpl * VPIPayload
A handle to an algorithm payload.
Definition: Types.h:181
vpiPayloadDestroy
void vpiPayloadDestroy(VPIPayload payload)
Deallocates the payload object and all associated resources.
VPIStream
struct VPIStreamImpl * VPIStream
Definition: Types.h:164