DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Feature Tracker Sample
Note
SW Release Applicability: This sample is available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

Description

The Feature Tracker sample demonstrates the feature detection and feature tracking capabilities of the Features module. It loads a video stream and reads the images sequentially. For each frame, it tracks features from the previous frame and detects new features in the current frame.

Running the Sample

The feature tracker sample, sample_feature_tracker, accepts the following optional parameters. If none are specified, it will perform detections on a supplied pre-recorded video.

./sample_feature_tracker --video=[path/to/video.h264]
                        --maxFeatureCount=[even_number]
                        --historyCapacity=[int_number]
                        --pyramidLevel=[int_number]
                        --detectMode=[0|1]
                        --pvaDetector=[0|1]
                        --pvaDetectorEngineNo=[0|1]
                        --detectLevel=[int_number]
                        --cellSize=[int_number]
                        --scoreThreshold=[fp_number]
                        --detailThreshold=[fp_number]
                        --numEvenDistributionPerCell=[int_number]
                        --harrisK=[fp_number]
                        --harrisRadius=[int_number]
                        --gradientSize=[3|5|7]
                        --blockSize=[3|5|7]
                        --NMSRadius=[int_number]
                        --maskType=[0|1]
                        --enableMaskAdjustment=[0|1]
                        --trackMode=[0|1]
                        --pvaTracker=[0|1]
                        --pvaTrackerEngineNo=[0|1]
                        --windowSize=[int_number]
                        --numIterTranslation=[int_number]
                        --numIterScaling=[int_number]
                        --numTranslationOnlyLevel=[int_number]
                        --nccUpdateThreshold=[fp_number]
                        --nccKillThreshold=[fp_number]

where

--video=[path/to/video.h264]
    Is the absolute or relative path of a h264 or RAW/LRAW video.
    Containers such as MP4, AVI, MKV, etc. are not supported.
    Default value: path/to/data/samples/sfm/triangulation/video_0.h264.

--maxFeatureCount=[even_number]
    Specifies the maximum number of features that can be stored.
    Note that only even numbers will work. If using PVA Sparse LK feature tracker,
    maxFeatureCount needs to be set as no more than 512.
    Default value: 8000

--historyCapacity=[int_number]
    Specifies how many features are going to be stored.
    Default value: 60

--pyramidLevel=[int_number]
    Defines the number of pyramid levels while tracking.
    Higher level provides better results for large motion, but takes more time.
    If using PVA Sparse LK feature tracker, pyramidLevel needs to be set as no more than 4.
    Default value: 5

--detectMode=[0|1]
    Defines detecting mode
    0: Standard Harris corner detector with fixed pipeline.
    1: Extended Harris corner detector, more flexible but takes more time.
    Default value: 0

--pvaDetector=[0|1]
    When set to 1, the feature detector algorithm is performed on PVA hardware.
    Otherwise, it is performed on GPU.
    Note that PVA can only be used in combination with --detectMode=0.
    Default value: 0

--pvaDetectorEngineNo=[0|1]
    If pvaDetector is set as 1, determines on which PVA the detector should run on.
    Default value: 0

--cellSize=[int_number]
    Defines the size of a cell. Input images will be split into cellSize x cellSize structures.
    Default value: 64

--scoreThreshold=[fp_number]
    Defines the minimum score for which a point is classified as a feature.
    Lower value will output more features, higher value will only keep the high frequency points.
    When --detectMode=0 and --pva=1, this should be a uint value and greater than 0.
    Default value: 4.05e-6

--detailThreshold=[fp_number]
    Defines the minimum score for which a point is classified as a detail feature. A detail feature has higher priority to be output during detection.
    Higher values will output more even distribution, and lower values will have more features in high frequency area.
    This parameter only takes effect when --detectMode=0.
    Default value: 0.0128

--numEvenDistributionPerCell=[int_number]
    Defines the number of features to be selected in each cell, where the score is within [scoreThreshold, detailThreshold)
    This parameter only takes effect when --detectMode=0.
    Default value: 5

--harrisK=[fp_number]
    Defines Harris K value.
    This parameter only takes effect when --detectMode=1.
    Default value: 0.05

--harrisRadius=[int_number]
    Defines Harris radius.
    This parameter only takes effect when --detectMode=1.
    Default value: 1

--gradientSize=[3|5|7]
    Define gradient window size for PVA feature detector.
    This parameter only takes effect when --detectMode=0 and --pva=1.
    Default value: 3

--blockSize=[3|5|7]
    Define block window size used to compute the Harris Corner score in PVA.
    This parameter only takes effect when --detectMode=0 and --pva=1.
    Default value: 3

--NMSRadius=[int_number]
    Defines non-maximum suppression filter radius.
    This parameter only takes effect when --detectMode=1.
    Default value: 1

--maskType=[0|1]
    Defines output distribution type.
    0: Uniform distribution
    1: Gaussian distribution
    This parameter only takes effect when --detectMode=1.
    Default value: 1

--enableMaskAdjustment=[0|1]
    Defines whether the detector will update output distribution mask before each detection.
    0: disable
    1: enable
    This parameter only takes effect when --detectMode=1.
    Default value: 1

--trackMode=[0|1]
    Defines tracking mode.
    0: translation-only inverse additive KLT tracking or Sparse LK PVA tracking.
    1: translation-scaling inverse compositional KLT tracking.
    Default value: 0

--pvaTracker=[0|1]
    When set to 1, the feature tracking algorithm is performed on PVA.
    Otherwise, it is performed on GPU.
    trackMode needs to be set as 0 to use PVA tracker.
    Default value: 0

--pvaTrackerEngineNo=[0|1]
    If pvaTracker is set as 1, determines on which PVA the tracker should run on.
    Default value: 0

--windowSize=[int_number]
    Defines the feature window size.
    --trackMode=0 supports windowSize=6,8,10,12,15
    --trackMode=1 supports windowSize=10,12
    Default value: 10

--numIterTranslation=[int_number]
    Defines the KLT iteration number for translation-only tracking.
    Larger number gives better prediction, but takes more time.
    Default value: 8

--numIterScaling=[int_number]
    Defines the KLT iteration number for translation-scaling tracking.
    Larger number gives better prediction, but takes more time.
    This parameter only takes effect when --trackMode=1.
    Default value: 10

--numTranslationOnlyLevel=[int_number]
    Defines number of translation-only tracking in pyramid. The tracker will apply
    translation-only tracking on the highest numTranslationOnlyLevel level images.
    This parameter only takes effect when --trackMode=1.
    Default value: 4

--nccUpdateThreshold=[fp_number]
    Defines the minimum ncc threshold that will cause the feature tracker to update
    the image template for a particular feature.
    Default value: 0.95

--nccKillThreshold=[fp_number]
    Defines the minimum ncc threshold to mantain a particular feature in the tracker.
    Default value: 0.3 

Output

The sample creates a window, displays the video, and overlays the list of features.

There are two modes for feature drawing:

  • (default) feature trajectories will be overlaid (up to previous 10 frames of history).
  • Only the current feature positions will be overlaid by small squares. You can switch drawing mode by pressing 'h' key.

Different colors represent the age for each feature. The age refers to how many frames have been tracked.

  • Red: 1 <= age < 5
  • Yellow: 5 <= age < 10
  • Green: 10 <= age < 20
  • Light blue: 20 <= age
sample_feature_tracker.png
Tracked feature points on a single H.264 stream

Additional Information

For more details see Single Camera Feature Tracking.