NVIDIA VPI GStreamer Plug-in - Examples - Perspective Warp

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: Examples/KLT Tracker Index Next: Examples/Overlay





Introduction

The vpiwarp element applies the Perspective Warp algorithm from the NVIDIA VPI library to a video stream.

Element properties

  • backend

Backend to use to execute VPI algorithms. Available options:

cpu: CPU backend
cuda: CUDA backend
pva: PVA backend (Xavier only)
vic: VIC backend

Flags: readable, writable
Default: "cuda"

  • interpolator

Interpolation method to be used. Available options:

nearest: Nearest neighbor interpolation
linear: Fast linear interpolation
catmull: Fast Catmull-Ron cubic interpolation

Flags: readable, writable
Default: linear

  • behavior

Flag to modify algorithm behavior. Available options:

direct: The provided transformation matrix is direct, so the algorithm will invert it internally
inverted: The provided transformation matrix is already inverted, so the algorithm will not invert it

Flags: readable, writable
Default: direct

  • transformation

3x3 transformation matrix. If not provided, no transformation will be performed.
Usage example: <<1.0,0.0,0.0>,<0.0,1.0,0.0>,<0.0,0.0,1.0>>
Type: GstValueArray of GValues of type GstValueArray
Flags: readable, writable
Default: <<1.0,0.0,0.0>,<0.0,1.0,0.0>,<0.0,0.0,1.0>>

  • demo

Put the element in demo mode to showcase its capabilities. In this mode, the incoming image will be rotated in the 3D space and projected back to the image plane. Will override the transformation matrix.
Type: Boolean
Flags: readable, writable
Default: false

Perspective Warp Example

The following example pipe will help you apply perspective warp to the input video stream from your camera. You may modify the properties values according to the information above.

  • Unified memory
gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! 'video/x-raw' ! vpiupload ! vpiwarp transformation="<<0.5386, 0.1419, -74.0>, <-0.4399, 0.8662, 291.5>, <-0.0005, 0.0003, 1.0>>" ! vpidownload ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvoverlaysink
  • NVMM memory
gst-launch-1.0 nvarguscamerasrc ! nvvidconv bl-output=false ! 'video/x-raw(memory:NVMM)' ! vpiupload ! vpiwarp transformation="<<0.5386, 0.1419, -74.0>, <-0.4399, 0.8662, 291.5>, <-0.0005, 0.0003, 1.0>>" ! vpidownload ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvoverlaysink


Previous: Examples/KLT Tracker Index Next: Examples/Overlay