Applying Tracking Data

You can apply your tracking data to the input image using either the Tracker node’s controls, linking expressions, or other Nuke nodes.

Applying Tracking Data Using Tracker’s Controls

The simplest way to apply tracking data to the input image or other nodes is to use the controls of the Tracker node itself. Here, we look at using these controls to stabilize, match-move, and remove or apply jitter.

Stabilizing Elements

The Tracker node’s controls let you remove motion, such as unwanted camera shake, from the node’s input clip. You can use a single track to stabilize horizontal and vertical motion across the 2D plane, or two or more tracks to eliminate rotation and scale.

1.   Create the track(s) you want to use for stabilizing the footage:

If you’re using a single track, ensure T is selected in the Tracks list, so that Tracker only calculates translation.

On the Transform tab, select transform > stabilize 1-pt to lock the Filter to Keys. This filter produces the best results when using a single track.

If you’re using more than one track in the Tracks list, select the transformations that you want Tracker to calculate when stabilizing the image, Translation, Rotation, and/or Scale.

On the Transform tab, select transform > stabilize.

2.   Set the reference frame if you don’t want to use the first frame as the transform control frame.
3.   Use the smooth controls to average frames together to smooth the transforms applied.

For example, if you’re stabilizing using more than one track, you might average frames together for translation and rotation by entering the number of frames in the t and r fields.

4.   Select the required filter. See Choosing a Filtering Algorithm for more information.

Nuke stabilizes the footage, locking its elements to the same position within the composite.

Note:  You can export the transform information to a linked or baked Transform node by selecting the required type from the Export dropdown and clicking create.

Match-moving Elements

You can use the Tracker node’s controls to apply the tracked motion to another image, that is, to match-move an image.

1.   Use a Tracker node to track the feature you intend to match.
2.   Copy the Tracker node and paste it after the footage you want to match-move.
3.   In the second Tracker node’s controls, go to the Transform tab.
4.   From the transform dropdown menu, select match-move.
5.   Set the reference frame if you don’t want to use the first frame as the transform control frame.
6.   Use the smooth controls to average frames together to smooth the transforms applied.

For example, if you’re using more than one track, you might average frames together for translation and rotation by entering the number of frames in the t and r fields.

7.   Select the required filter. See Choosing a Filtering Algorithm for more information.

Nuke applies the tracked movement to the footage you want to match-move. A simple script might appear as follows, where Tracker2 is a copy of Tracker1:

A simple match-move script.

Note:  You can export the transform information to a linked or baked Transform node by selecting the required type from the Export dropdown and clicking create.

Removing or Adding Jitter

Tracker can be used to remove high frequency jitter from a sequence, exaggerate existing jitter, or add jitter to another sequence for a consistent look.

To remove jitter:

1.   Create the tracks you want to use for jitter removal.
2.   In the Tracker node’s controls, go to the Transform tab.
3.   From the transform dropdown menu, select remove jitter.
4.   Set the reference frame if you don’t want to use the first frame as the transform control frame.
5.   Use the jitter period to average together frames, adjusting the jitter to achieve the required stability.
6.   Use the smooth controls to average frames together to smooth the transforms applied.

For example, if you’re removing jitter using more than one track, you might average frames together for translation and rotation by entering the number of frames in the t and r fields.

7.   Select the required filter. See Choosing a Filtering Algorithm for more information.
8.   Nuke removes jitter from the footage, locking its elements to the same position within the composite.

To exaggerate or add jitter:

1.   Create the tracks you want to use for the required jitter operation.
2.   In the Tracker node’s controls, go to the Transform tab.
3.   From the transform dropdown menu, select add jitter.
4.   Set the reference frame if you don’t want to use the first frame as the transform control frame.
5.   Use the jitter period to average together frames, adjusting the jitter to achieve the required instability.
6.   Use the smooth controls to average frames together to smooth the transforms applied.

For example, if you’re adding jitter using more than one track, you might average frames together for translation and rotation by entering the number of frames in the t and r fields.

7.   Select the required filter. See Choosing a Filtering Algorithm for more information.

Nuke exaggerates the tracked jitter in the footage.

Note:  If you want to transfer jitter to another sequence, copy the Tracker node and paste it after the footage to which you want to add jitter, then follow steps 3-7 above.

Applying Tracking Data Using Linking Expressions

Nuke’s CornerPin2D and Stabilize2D nodes are specifically designed to receive tracking data by linking expressions, but you can apply tracking data in this manner to virtually any Nuke node. For example, you might animate a Bezier or a B-spline shape with tracking data by entering linking expressions into the RotoPaint node’s transformation parameters. You can also apply tracking data to individual points.

This section explains the basic procedure for applying tracking data to any node via linking expressions.

Creating Linking Expressions

The Tracker node’s Tracker panel displays data related to the position of each track anchor over time (tracks’ x and y fields). This is the data that you most typically apply to other nodes.

To Drag and Drop Tracking Data:

1.   Display both the Tracker parameters and the parameters to which you wish to apply the tracking data (the destination control - for example, a RotoPaint node’s translate control).
2.   Select the required track from the Tracks list. Only one track can be linked per control.
3.   Ctrl+drag (Cmd+drag on a Mac) from the source control animation button to the destination control animation button.

When you release, the destination control will turn blue, indicating an expression has been applied. In this case, the drag and drop action has created a linking expression resembling the following example:

Tracker1.tracks.1.track_x

Tip:  You can also apply tracking (or other transform) data to individual RotoPaint, SplineWarp, or GridWarp points (this is sometimes called per vertex tracking). To do so, Ctrl/Cmd+drag and drop the track’s animation button on a RotoPaint, SplineWarp or GridWarp point in the Viewer.

You can add other components to this linking expression as necessary. For example, you might add a spatial offset to the linking expression by subtracting out the initial frame’s tracking values, in which case the final expression would resemble the following:

Tracker1.tracks.1.track_x-Tracker1.tracks.1.track_x(1)

See Expressions for more information. Once you enter the linking expression, the destination parameter turns blue.

To Link Animated Parameters with a Tracker Node

You can also link controls with the Tracker node if you use the Link to option in the Animation menu. For example, to link the translate control of the Roto node with a Tracker node, do the following:

1.   Create the Tracker node you want to link to.
2.   Go to Tracker’s Transform tab and enable live-link transform.

This control enables Tracker to update dynamically as the expression link changes.

3.   On the Transform tab of the Roto node’s properties panel, click on the translate animation menu.
4.   Select Link to > Tracker linking dialog.
5.   Select the Tracker node you want to use in the tracker node dropdown and in the link to dropdown, select whether you want to link to the position of the track, the translate values of the track, or treat the translate value as an offset.
6.   Select which tracks you want to use by checking the track boxes. The Expression field updates with the appropriate expression syntax. If you select more than one track, the tracks are averaged, for example:

(Tracker1.tracks.1.track_x + Tracker1.tracks.2.track_x)/2

7.   Then click OK, and your linking is done.

Your Bezier shape’s translate value now changes when the Tracker value is changed.

Transforming Masks with Tracking Data

Creating animated masks using Roto and keyframes can be a very time-consuming process, but Nuke's Tracker node can do some of the initial work for you, especially with garbage mattes.

Once you have some solid tracking data, you can drive a roto shape without keyframing individual points:

1.   Track a feature in the area you intend mask. In the example, the figure's head serves as the driving point for the matte.

2.   Add a Roto node to the script (keyboard shortcut O) and draw the shape you intend to drive with the tracking data. In this case, we don't need to be too accurate as we're creating a garbage matte.

3.   In the Roto properties panel, click the Transform tab and select the matte in the shapes list.
4.   Right-click the translate control's animation icon and then select Link to > Tracker 1 > track 1.

The Tracker's track_z and track_y keyframes are copied into the Roto's translate control, applying the same translate and offset to the matte shape.

5.   To compensate for this, select the Root item in the shape list and reposition the Roto shape correctly using the transform handle in the Viewer.

The matte with offset. The same matte after repositioning.
6.   Scrub the playhead to see the matte following the tracked path.

Using the CornerPin2D Node

The CornerPin2D node is designed to map the four corners of an image sequence to positions derived from tracking data. In practice, this node lets you replace any four-cornered feature with another image sequence. For example, suppose you needed to replace the monitor image in the fast-panning shot shown below.

Fast-panning shot requires four-corner
tracking.

First, use the Tracker to calculate four separate tracks, one for each corner of the feature.

Generating the four tracks.

Next, attach a CornerPin2D node to the image sequence you want to use as the replacement for the feature, and apply the tracking data. This remaps the image sequence’s corners to the correct positions over time. You can create the node manually, or by using Tracker’s Export dropdown.

The final step is to layer the result over the original element.

The composited image.

The steps below summarize the use of Tracker’s Export CornerPin2D workflow.

To Use the CornerPin2D Node

1.   Generate four tracks, one per corner, on the feature requiring replacement.
2.   Use the current frame or reference frame field to specify the frame to use as the starting point. You can also decide whether the CornerPin2D node is expression linked or baked using the Export dropdown:

CornerPin2D (use current frame)

CornerPin2D (use transform ref frame)

CornerPin2D (use current frame, baked)

CornerPin2D (use transform ref frame, baked)

3.   Click create to add the CornerPin2D node to the script.
4.   Attach the image or sequence to replace the feature tracked to the input of the CornerPin2D node.
5.   If necessary, select a different filtering algorithm from the filter dropdown menu. See Choosing a Filtering Algorithm for more information.
6.   When filtering with Keys, Simon, or Rifmen filters, you may see a haloing effect caused by the pixel sharpening these filters employ. If necessary, check clamp to correct this problem.
7.   In most cases, you will keep black outside checked. This renders black pixels outside the image boundary, making it easier to layer the element over another. (If you uncheck this parameter, the outside area is filled with the outermost pixels of the image sequence.)
8.   The final step is to layer the result over the original element.

A simple script might appear as follows: