NVIDIA VPI GStreamer Plug-in - Examples - KLT Tracker
GstVPI |
---|
GstVPI Basics |
Getting Started |
Examples |
Performance |
Contact Us |
Introduction
The vpiklttracker element applies the KLT Feature Tracker algorithm from the NVIDIA VPI library to a video stream and draws the tracking boxes over the stream.
Note: This element by itself only computes the positions and size of the boxes (X and Y coordinates, width, and height). In order to draw them on the image, you must use the vpioverlay element after it. |
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"
- boxes
Nx4 matrix where N is the number of bounding boxes. Each bounding box (<x, y, w, h>) contains the x and y positions (x, y) of the box top left corner and the width and height (w, h) of the bounding box. The maximum of bounding boxes is 64, and the minimum and maximum size for each bounding box is 4x4 and 64x64 respectively. Usage example: '<<613,332,23,23>,<790,376,41,22>>'.
Type: GstValueArray of GValues of type GstValueArray
Flags: readable, writable
Default: No boxes
- max-scale
Scale changes larger than this will make KLT consider that tracking was lost. Must be positive.
Type: Double
Range: 0 - 1,797693e+308
Flags: readable, writable
Default: 0.2
- max-trans
Translation changes larger than this will make KLT consider that tracking was lost. Must be positive.
Type: Double
Range: 0 - 1,797693e+308
Flags: readable, writable
Default: 0.2
- threshold-kill
Threshold to consider template tracking was lost. Must be a value between 0 and 1 but the relationship between the other thresholds must be the following: 0 < kill <= update <= stop <= 1.
Type: Double
Range: 0.0001 - 1
Flags: readable, writable
Default: 0.6
- threshold-stop
Threshold to stop estimating. Must be a value between 0 and 1 but the relationship between the other thresholds must be the following: 0 < kill <= update <= stop <= 1.
Type: Double
Range: 0.0001 - 1
Flags: readable, writable
Default: 1
- threshold-update
Threshold for requiring template update. Must be a value between 0 and 1 but the relationship between the other thresholds must be the following: 0 < kill <= update <= stop <= 1.
Type: Double
Range: 0.0001 - 1
Flags: readable, writable
Default: 0.8
- scaling-iterations
Number of inverse compositional iterations of scale estimations.
Type: Integer
Range: 0 - 2147483647
Flags: readable, writable
Default: 20
Element Actions
- new-box
Appends a new bounding box to track on the fly. Parameters:
- x: top left corner X coordinate
- y: top left corner Y coordinate
- width: width of the bounding box in pixels
- height: height of the bounding box in pixels
KLT Tracker Example
The following example pipe will help you detect and draw bounding boxes in a video stream coming from a file. You may modify the properties values according to the information above. The video used in this pipeline is installed by default with the VPI samples.
gst-launch-1.0 filesrc location=/opt/nvidia/vpi/samples/assets/dashcam.mp4 ! decodebin ! nvvidconv ! video/x-raw ! vpiupload ! vpiklttracker name=klt boxes="<<613,332,23,23>,<669,329,30,29>,<790,376,41,22>>" ! vpioverlay color=white ! vpidownload ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvoverlaysink
Alternative display pipeline.
gst-launch-1.0 filesrc location=/opt/nvidia/vpi/samples/assets/dashcam.mp4 ! decodebin ! nvvidconv ! video/x-raw ! vpiupload ! vpiklttracker name=klt boxes="<<613,332,23,23>,<669,329,30,29>,<790,376,41,22>>" ! vpioverlay color=white ! vpidownload ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvvidconv ! autovideosink