Using the tracker functionalities

All tracking functionalities are gathered in the Tracker class. For now, only the tracker node can have a Tracker object. The Tracker by Natron and can be accessed as an attribute of the tracker node:


The tracker object itself is a container for tracks. The Track class represent one marker as visible by the user on the viewer.

Tracks can be accessed via their script-name directly:


The script-name of the tracks can be found in the settings panel of the Tracker node.

Getting data out of the tracks:

In Natron, a track contains internally just parameters which can hold animated data just like regular parameters of the effect class

You can access the parameters directly with their script-name:


Or you can use the getParam(paramScriptName) function:


Here is an example that retrieves all keyframes available on the center point for a given track:

myTrack = app.Tracker1.tracker.track1

keyframes = []

# get the number of keys for the X dimension only and try match the Y keyframes
nKeys = myTrack.centerPoint.getNumKeys(0)
for k in range(0,nKeys):

        # getKeyTime returns a tuple with a boolean value indicating if it succeeded and
        # the keyframe time

        gotXKeyTuple = myTrack.centerPoint.getKeyTime(k, 0)
        frame = gotXKeyTuple[1]

        # Only consider keyframes which have an X and Y value
        # If Y does not have a keyframe at this frame, ignore the keyframe
        # getKeyIndex returns a value >=0 if there is a keyframe
        yKeyIndex = myTrack.centerPoint.getKeyIndex(frame, 1)

        if yKeyIndex == -1:

        # Note that even if the x curve or y curve didn't have a keyframe we
        # could still call getValueAtTime but the value would be interpolated by
        # Natron with surrounding keyframes, which is not what we want.

        x = myTrack.centerPoint.getValueAtTime(frame, 0)
        y = myTrack.centerPoint.getValueAtTime(frame, 1)


print keyframes

Creating Tracks

To create a new track, use the createTrack() function made available by the Tracker class. You can then set values on parameters much like everything else in Natron.