Main Content

initializeTrack

Initialize new track

Description

example

trackID = initializeTrack(tracker,track) initializes a new track in the tracker. The tracker must be updated at least once before initializing a track. If the track is initialized successfully, the tracker assigns the output trackID to the track, sets the UpdateTime of the track equal to the last step time in the tracker, and synchronizes the data in the input track to the initialized track.

A warning is issued if the tracker already maintains the maximum number of tracks specified by itsMaxNumTracks property. In this case, the trackID is returned as 0, which indicates a failure to initialize the track.

trackID = initializeTrack(tracker,track,filter) initializes a new track in the tracker, using a specified tracking filter, filter.

Examples

collapse all

Create a multi-object tracker and update the tracker with detections at t=0 and t=1second.

tracker = multiObjectTracker
tracker = 
  multiObjectTracker with properties:

                  TrackerIndex: 0
       FilterInitializationFcn: 'initcvkf'
           AssignmentThreshold: [30 Inf]
                  MaxNumTracks: 200
                 MaxNumSensors: 20

                  OOSMHandling: 'Terminate'

         ConfirmationThreshold: [2 3]
             DeletionThreshold: [5 5]

            HasCostMatrixInput: false
    HasDetectableTrackIDsInput: false
               StateParameters: [1x1 struct]

                     NumTracks: 0
            NumConfirmedTracks: 0

detection1 = objectDetection(0,[1;1;1]);
detection2 = objectDetection(1,[1.1;1.2;1.1]);
tracker(detection1,0);
currentTrack = tracker(detection2,1);

As seen from the NumTracks property, the tracker now maintains one track.

tracker
tracker = 
  multiObjectTracker with properties:

                  TrackerIndex: 0
       FilterInitializationFcn: 'initcvkf'
           AssignmentThreshold: [30 Inf]
                  MaxNumTracks: 200
                 MaxNumSensors: 20

                  OOSMHandling: 'Terminate'

         ConfirmationThreshold: [2 3]
             DeletionThreshold: [5 5]

            HasCostMatrixInput: false
    HasDetectableTrackIDsInput: false
               StateParameters: [1x1 struct]

                     NumTracks: 1
            NumConfirmedTracks: 1

Create a new track using the objectTrack object.

newTrack = objectTrack()
newTrack = 
  objectTrack with properties:

             TrackID: 1
            BranchID: 0
         SourceIndex: 1
          UpdateTime: 0
                 Age: 1
               State: [6x1 double]
     StateCovariance: [6x6 double]
     StateParameters: [1x1 struct]
       ObjectClassID: 0
          TrackLogic: 'History'
     TrackLogicState: 1
         IsConfirmed: 1
           IsCoasted: 0
      IsSelfReported: 1
    ObjectAttributes: [1x1 struct]

Initialize a track in the GNN tracker object using the newly created track.

trackID = initializeTrack(tracker,newTrack)
trackID = uint32
    2

As seen from the NumTracks property, the tracker now maintains two tracks.

tracker
tracker = 
  multiObjectTracker with properties:

                  TrackerIndex: 0
       FilterInitializationFcn: 'initcvkf'
           AssignmentThreshold: [30 Inf]
                  MaxNumTracks: 200
                 MaxNumSensors: 20

                  OOSMHandling: 'Terminate'

         ConfirmationThreshold: [2 3]
             DeletionThreshold: [5 5]

            HasCostMatrixInput: false
    HasDetectableTrackIDsInput: false
               StateParameters: [1x1 struct]

                     NumTracks: 2
            NumConfirmedTracks: 2

Input Arguments

collapse all

Multi-object tracker, specified as a multiObjectTracker System object.

New track to be initialized, specified as an objectTrack object or a structure. If specified as a structure, the name, variable type, and data size of the fields of the structure must be the same as the name, variable type, and data size of the corresponding properties of the objectTrack object.

Data Types: struct | object

Filter object, specified as a trackingKF, trackingEKF, or trackingUKF object.

Output Arguments

collapse all

Track identifier, returned as a nonnegative integer. trackID is returned as 0 if the track is not initialized successfully.

Example: 2

Introduced in R2020a