*****************************************************************************
* Copyright (c) 2019 NVIDIA Corporation.  All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto.  Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA Corporation is strictly prohibited.
*****************************************************************************

Prequisites:

Please follow instructions in the apps/sample_apps/deepstream-app/README on how
to install the prequisites for Deepstream SDK, the DeepStream SDK itself and the
apps.

Compilation Steps:
  $ cd apps/deepstream-nvof-test/
  $ make
  $ deepstream-nvof-app <uri1> [uri2] ... [uriN]

This document shall describe about the sample deepstream-nvof-app application.

Optical Flow (nvof gstreamer plugin):
NVIDIA GPUs, starting with the Nvidia GPU Turing generation and Jetson Xavier generation,
contain a hardware accelerator for computing optical flow. Optical flow vectors are
useful in various use cases such as object detection and tracking, video frame rate
up-conversion, depth estimation, stitching, and so on.
The gst-nvof plugin collects a pair of NV12 images and passes it to the low-level
optical flow library. The low-level library returns a map of flow vectors between
the two frames as its output. The map of flow vectors is encapsulated in an
NvOpticalFlowMeta structure and is added as a user meta for each frame in the batch
using nvds_add_user_meta_to_frame() function.

Optical Flow Visualization (nvofvisual gstreamer plugin):
The Gst-nvofvisual plugin is useful for visualizing motion vector data.
The visualization method is simmilar to the OpenCV reference source code in:
https://github.com/opencv/opencv/blob/master/samples/gpu/optical_flow.cpp
The plugin solves the optical flow problem by computing the magnitude and direction of
optical flow from a two-channel array of flow vectors.
It then visualizes the angle (direction) of flow by hue and the distance (magnitude) of
flow by value of Hue Saturation Value (HSV) color representation.
The strength of HSV is always set to a maximum of 255 for optimal visibility.


This sample creates instance of "nvof" & "nvofvisual" gstreamer elements.

1) nvof element generates the MV (motion vector) data and attaches as
   user-meta data.

2) nvofvisual element is used for visualizing the MV data using pre-defined
   color wheel matrix.

