DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Dense Optical Flow Sample

Description

The Dense Optical Flow module sample demonstrates the Dense Optical Flow pipeline on multiple hardware units:

  • VIC (Video Image Compositor).
  • NVIDIA NVENC (NVIDIA Video Encoder).
  • PVA (Programmable Vision Accelerator).

The Dense Optical Flow sample accepts RAW videos, h264 videos, or live camera input data from an AR0231 (revision >= 4) sensor. It then applies an optical flow algorithm to estimate motion vectors between frames.

Running the Sample

The DenseOpticalFlow sample, sample_denseopticalflow, accepts the following optional parameters. If none are specified, it performs detections on a supplied pre-recorded video.

./sample_denseopticalflow --input-type=[video|camera]
                          --video=[path/to/video]
                          --camera-type=[camera]
                          --camera-group=[a|b|c|d]
                          --camera-index=[0|1|2|3]
                          --estimationMode=[UHP|HP|HQ]
                          --nvencNo=[0|1]
                          --pvaNo=[0|1]

Where:

--input-type=[video|camera]
        Defines if the input is from live camera or from a recorded video.
        Live camera is supported only on NVIDIA DRIVE(tm) platforms.
        It is not supported on Linux (x86 architecture) host systems.
        Default value: video

--video=[path/to/video]
        Specifies the absolute or relative path of a raw, lraw or h264 recording.
        Only applicable if --input-type=video
        Default value: path/to/data/samples/stereo/left_1.h264

--camera-type=[camera]
        Specifies a supported AR0231 `RCCB` sensor.
        Only applicable if --input-type=camera.
        Default value: ar0231-rccb-bae-sf3324

--camera-group=[a|b|c]
        Is the group where the camera is connected to.
        Only applicable if --input-type=camera.
        Default value: a

--camera-index=[0|1|2|3]
        Indicates the camera index on the given port.
        Default value: 0

--estimationMode=[UHP|HP|HQ]
        Indicates the quality and the performance of Dense Optical Flow algorithm:
        - HP: High Performance
        - UHP: Ultra High Performance
        - HQ: High Quality
        Default value: HP

--nvencNo=[0|1]
        Indicates on which Nvidia Video Encoder the corresponding stage of the pipeline is to be executed.
        Default value: 0

--pvaNo=[0|1]
        Indicates on which PVA engine the corresponding stage of the pipeline is to be executed.
        Default value: 0

Examples

To run the sample on a video

./sample_denseopticalflow --input-type=video --video=<video file>

To run the sample on a camera on NVIDIA DRIVE platforms

./sample_dense_opticalflow --input-type=camera --camera-type=<camera type> --camera-group=<camera group> --camera-index=<camera idx on camera group>

To run the sample on non-default engines

./sample_denseopticalflow --nvencNo=1 --pvaNo=1

Output

The sample creates a window and displays a video with two sections. The section above demonstrates the original video, whereas the section below shows the result of Dense Optical Flow with color coding presented at https://hci.iwr.uni-heidelberg.de/Correspondence_Visualization/.

sample_denseopticalflow.png
Dense Optical Flow

Additional information

For more information, see Dense Optical Flow.