I got really good feedback especially on the Reconcile3D Tutorial, so I decided to continue this with another tip of the month. This time I want to use matchmoving data to stabilize my footage. So for the 3d matchmove I usually use Pftrack, which is simple and really solid. You can use whatever software you like of course ;-)
So when the tracking is done I usually export my data to Maya (in the newer version of Pftrack, you can export a Nuke script as well) to check if everything matches.
Continue When you open the scene in Maya you usually have to set your camera environment to display your image sequence, so that you can simply see whether your tracking locators are solid.
Now select one locator of your choice and export it as a .chan file. You can use the MayaExport script found on fxshare (here), or you can use the moCon script found here. I prefer the moCon script, because it does all the calculation for you. If you want to use the ExportChan script keep in mind that you have to change your vertical and horizontal aperture (Maya uses inches whereas Nuke uses mm) and also your focal length, so that it matches exactly. Another important hint is, that Pftrack exports your Maya file with the starting point set to 0. So be sure to offset your footage in Nuke so that it also starts at 0. So when launching Nuke the first thing to do is to set up your framerate. When you use the footage from this tutorial set it to 25, and also set the root format to PAL (720*576).
Now read in your footage and create a camera from your 3D menu. Import the camera.chan file. Create an Axis node and also read in the locator2.chan file. In your camera go to Projection and set up your Focal Length (20.251) and for horizontal aperture use 20.1201 and vertical is 15.09. Don't forget to offset your footage so that it starts at frame 0.
To check the setup in Nuke I usually build a 3D scene, add a sphere that is positioned by the Axis node, and but this Sphere over my Footage. You can see the tree in the image below (By the way when using the moCon script you won't get an Axis node for your locator, instead you will find a 3DTransform node in your scene-you can simply Cmd+Drag the transformation values to a new Axis).
So now you are ready to use the Reconcile3D node. Add it to your footage and connect the Camera and your Axis. Important hint: the image input needs to be the right resolution! So to be sure it works, use your footage as the img input. Now hit the "create keyframes" button to calculate keys (be sure to calculate the keys starting from 0!). You will notice that your footage is transformed to the origin of your Axis node. So if you want to stabilize your footage, you have to invert this transformation. To do this, switch on the stabilize option.
Now the problem is, that you are inverting the transformation that was based on your Axis' origin, which means that your footage is not centered anymore. Therefore you find the offset settings. Go to frame 0 and tweak the offset so that your footage is back in frame.
You can watch your Viewers upper right corner. Try to offset your footage so that it has your starting resolution. Usually the offset of your first frame should be the inverted values of your transformation.
When you now play back your shot you'll notice that it sticks to the point where your locator was, so it is absolutely stable. This is a fast and really simple way to stabilize your shot based on a 3D matchmove. If you want to stabilize based on more points feel free to export more locators. There is no need to render out spheres or anything else to be tracked in Nuke, because you can use your camera and the locators information to calculate their positions.
I hope everybody enjoyed this little tutorial and you will check back for more.
To get all the footage, together with the Maya scene and the Nuke file, click here. Enjoy!