10 Replies Latest reply on Jun 7, 2011 11:41 PM by Mathias Möhl

# Motion tracking: matching two tracked elements

Hi all,

In slightly over my head... searched high and low... but I am stuck.

I have two video elements in a composition, both VERY similar, but they don't track perfectly.

What I tried to do was taking the tracking data from one element, and subtracting the tracking from the second element in expressions (to get a delta), and then apply the difference to the anchor point of the element.  This did not work... as I expected.

I have two good tracks, but I can't figure out how to get these tracks to work together (they are tracking the exact same point) to match them.  Is this a match move problem?

• ###### 1. Re: Motion tracking: matching two tracked elements

I'm really confused. Are these two elements in one shot or do you have two shots with the same element in each?

It would really help to see the shot or shots you're trying to track.

• ###### 2. Re: Motion tracking: matching two tracked elements

Assuming that you have one track on layer A and one track on layer B. Probably you want to first stabilize layer B with respect to its own track and then move it according to the track of layer A. Then the tracked point on B behaves exactly as the tracked point on A.

If you have problems with slight perspective differences, you can also track a corner pin for both A and B in Mocha and use MochaImport to

1) stabilize and undistort B

2) create a stabilized precomp of A

3) insert the stabilized and undistorted B into this precomp

Just make sure that the blue surface rectangle in Mocha is exactly the same in both tracks (e.g. set it to the entire composition by using the align surface button).

• ###### 3. Re: Motion tracking: matching two tracked elements

Thank you Mathias,

I can't stabalize because the shots both pan.

Imagine a dolly shot... moving smoothly though a scene.  That is shot A

Imagine a second dolly shot, on the same track, of the same scene.  That is shot B

Imagine that the dolly operator could not perfectly dolly the camera for each shot (how could they?).

But they are close.

I can pick the exact same track point on the dolly shot... so that gives me data on each dolly shot.

As you can see, there is nothing to stabalize.  Both shots are stable... they just track differently, slightly.

I am not using mocha.... this is a perfect 2D track situation.

I tried vector subtraction in expressions, subtracting tracker A from tracker B... that number should be the difference between the dolly shots, yes?

Now, if I use THAT number to offset one of the shots... that should cause them to realign, yes?

I feel I am close...

I am using the sub(v1,v2) expressions function.

This is probably simple, I'm just being thick headed about it somehow.

• ###### 4. Re: Motion tracking: matching two tracked elements

Now, if I use THAT number to offset one of the shots... that should cause them to realign, yes?

No. You are not accounting for differences in the visible area, camera banking, possibly spherical distortion as well as zoom artifacts commonly associated with dollying shots, you are merely stabilizing some arbitrary point whose presentation in pixels is in very geeky technical terms never the same in both clips and the usual thing of different exposure, compression patterns etc. would further cause deviations. As a matter of fact what you want to do would be better done by subtracting the intra-layer deviations so your track point just sits in the same absolute coordinates in both layers and then simply stack them, trying to remove any distortion misalignment using effects like optics compenasation, Mesh Warp and Bezier Warp. This would require pre-composing of the stabilized layers before applying the unwarping, of course....

Mylenium

• ###### 5. Re: Motion tracking: matching two tracked elements

Hi Mylenium,

Since the shots don't have different zoom, and are locked rotationally, none of those things matter.

True, the visible area frame by frame is different... to handle this, I just increased the size of both elements to 104% so that I don't move off of the image.

In the end, I did solve it in precisely the way I thought... my mistake was that I didn't have to use sub()... the tracking data subtracts directly, and I also failed to specify the anchor point vector correctly.  I used parens instead of brackets.

Here is the expressions code, placed on the Anchor Point of track B, that worked:

motionTracker("Tracker A")("Track Point 1").featureCenter-thisComp.layer("dolly.avi").motionTracker("Tracker 1")

("Track Point 1").featureCenter+[360,240]

The shots now allign perfectly.

Perserverance wins the day!

Thank you all

• ###### 6. Re: Motion tracking: matching two tracked elements

The fact that you have a panning shot does not mean that you cannot stabilize.

Watch this tutorial:

http://www.mamoworld.com/index.php?option=com_content&view=article&id=96:tutorial-stabiliz e-motion-without-the-need-to-zoom-in&catid=35:tutorials&Itemid=85&lang=en

The shot is panning and even zooming. I first stabilize the shot completely and then reintroduce (a smoothed variant of) the motion. You need to do exactly the same thing except that you don't reintroduce a smoothed version of the movement but the movement of the other layer.

• ###### 7. Re: Motion tracking: matching two tracked elements

Hi Mathias,

that's a great tutorial...

I should have said I don't want to stabilize my shot... as it was shot stable on a dolly.  I can't stabilize it because it is stable.... if that makes sense.

• ###### 8. Re: Motion tracking: matching two tracked elements

No, is makes no sense. I am not taking about stabilizing away any shakes or jitter in the shot. I am talking about getting rid of all the dolly movement temporarily. Watch the tutorial again. I first apply (1) stabilize which makes the scene completely static (no dolly move anymore) such that the picture moves step by step out of frame. Then I apply (2) "move" such that the original movement is reintroduced and you are basically back to the original shot. (Which I then stabilize (3) in a third step). You should just skip (3) and use the track from the layer itself for (1) and the track from the other layer for (2).

I hope that makes it more clear. Just think of stabilizing not as "make the camera movement more smooth" but as "applying the inverse of a tracked movement".  You can use it to smooth a camera movement, but sometimes it makes also sense in other scenarios.

With your expression you do exactly the same, by the way. It says something like

"Motion tracker A - Motion tracker B + original Position".

This is like stabilize the position with respect to track B (subtract its movement) and move according to A (add its movement).

• ###### 9. Re: Motion tracking: matching two tracked elements

Hi Mathias,

I think I am beginning to understand... thank you for your patience.

The only problem I am having is that I don't see where you are getting tracking data from the second clip... you *must* have tracking data from both clips.

You get stabilization data from track 1, then apply it to the second video clip?

Or perhaps you are saying... get stabilization data for BOTH, then move data for BOTH, but SWAPPING the move data...  1 for 2 and 2 for 1.

Is this correct?

• ###### 10. Re: Motion tracking: matching two tracked elements

Yes, you must have tracking data for both clips. You use the tracking data from the layer itself to stabilize it and the tracking data from the other to move it (after it has been stabilized). Using the AE tracker you could

1) select layer B and stabilize it as usual

2) select layer A, track it, and apply the tracking data to some NULL

3) parent the stabilized layer B to that NULL

Now B behaves exactly like A