This video shows how to use the Clone Stamp tool with motion tracking:
There are offset properties for source position and such in the Paint panel. But why not just track the dots that you want to get rid of, rather than the plus sign?
Thanks I have already seen that video. But what I'm trying to learn is how to use expressions to get a object, picture or other footage to follow a null object or a track. And as you see there is two spots I need to remove, so if I could somehow use expressions to take care of it all in one operation and later use that same technique to get some placed text to follow a moving subject an so on...
It's the expression side of things I'm looking for in this case :-)
Expressions for this kind of thing are very difficult and nearly impossible if there is a lot of movement and perspective change in the shot. Here's why. Let's say your shot was taken with the camera very close to the clock panning from left to right to center the clock. With the camera very close to the subject as the camera clock starts to come into frame the distance between the left and right side of the base is much shorter than it is when the clock is centered in the frame. This means that you must track scale and position and make adjustments to your clone position based on the change in scale as well as the change in position. If you throw in horizon angle changes like you would get if the camera was tilted to the left as well as panned to the left but straightened (or the shot was hand held and the horizon didn't stay level) then you would also have to track and make adjustments for rotation. Now you start getting into trigonometry. Lastly, you run into problems that crop up with the distance and angle of the original sample. because there are no controls to modify the location of the source. If your source is 100 pixels to the left and 50 pixels above the clone position it will always be 100 pixels to the left and 50 pixels above the sample point. If the perspective and scale changes then your source will change and the clone image will change.
Now that you understand the problem I'll show you how to use an expression to offset position from a track point. I will assume that there is no rotation in the shot.
This is how you approach the problem. You'll need to collect data from the tracker position (t), the scale change (ts), the initial position of the clone (ip), the offset between the clone position and the tracker position at the first frame (ofst), then you will have to calculate the change in offset or adjusted offset (aofst) as the scale (ts) changes by multiplying the offset (ofst) by the scale (ts), then you will have to calculate the new position by adding the adjusted offset to the track position. Here's the expression and it assumes that you have applied tracking data to a null you have named "Tracker":
t = thisComp.layer("Tracker").transform.position;
ts = thisComp.layer("Tracker").transform.scale/100;
ip = t.valueAtTime(0);
ofst = (value - ip);
aofst = [ofst*ts, ofst*ts];
np = t + aofst;
Line 2, track scale is divided by 100 to convert percentage to a decimal so the multiplication in line 5 will give the right result.
Line 3 uses the value at time function to retrieve the position of the tracker at the start of the comp.
Line 4 calculates the offset by subtracting the value of the property, the clone position from the initial position of the tracker.
Line 5 adjusts the offset by multiplying the offset by the percentage. You have do to this calculation inside an array because scale and position are both arrays.
Line 6 simply adds the adjusted offset to the tracker position.
If there was rotation to throw into the mix you would have to use trigonometry to calculate the x and y offset based on the angle between the tracker position and the clone position. This would be fruitless because the offset position of the source for the clone would not change. In my example it would always be 100 pixels to the left and 50 pixels above the position of the clone.
A better solution with a moving shot would be to use the Motion Tracker to stabilize the shot removing the movement rotation and scale, applying that stabilization to the shot, duplicating the shot and naming the duplicate Clone, then using the original stabilized footage as the source, do the repairs with the clone tool, then set the clone to paint on transparent and drag that into your main comp and remove the stabilization using a null and a couple of expressions and a duplicate of your stabilized footage.
That is just perfect!
Thanks a lot for taking the time to make me understand. Offsetting the tracking data was exactly what I was looking for without having the right words to explain it in my initial post. Can't wait to try it out in AE.
For people who reads this post and don't wanna go crazy with expressions I found another approach to those kind of problems as well...
After Effects Tutorial - How To Remove Anything From Your Shot: https://youtu.be/IVs167wMUGs