Adobe After Effects Forum
Experts: Tracked Mask, but Flipped?
Experts: Tracked Mask, but Flipped?
by Hank Leukart on Apr 16, 2019 at 1:04:19 am

This one has been driving me crazy all day. Imagine that someone in a very long handheld shot has a big lipstick smudge below the left side of her mouth. The right side of her mouth looks fine. She sometimes talks in the shot and moves her head.

I want to remove the lipstick smudge, so I:
1. Duplicate the layer.
2. Draw a mask on the dup-layer on the right side of her mouth -- the side without the lipstick problem.
3. Track the mask.
4. Flip the dup-layer by setting Scale to -100,100.
5. Move the flipped layer so that the flipped, right side of her mouth now covers the lipstick smudge on the left side of her mouth. Because the layer is flipped, but sitting atop of a non-flipped version, her mouth now looks fine (and symmetric). (i.e. "right side lips" are now "left side lips")

PROBLEM: As soon as I hit Play, the tracked mask moves in the wrong direction. The track always moves in the opposite direction of the way it should, because the layer has been flipped so that the right-side lips match the left-side lips.

I have tried a hundred ways to make it so that the tracked mask stays stuck to her mouth without manually setting every frame, but I can't figure it out. I'm aware that this could be done by trying to blending some skin near the lipstick smudge with the lipstick smudge (i.e. basic clone stamp + mask track) but it looks significantly better with the method I describe above, if I could get it to work. Has some genius AE expert on here has done this before successfully?

Re: Experts: Tracked Mask, but Flipped?
by Kalleheikki Kannisto on Apr 16, 2019 at 7:02:18 am

I would say you want to stabilize the flipped piece of footage and track the other side of the mouth, then apply that tracking to the piece.

Kalleheikki Kannisto
Senior Graphic Designer

Re: Experts: Tracked Mask, but Flipped?
by Hank Leukart on Apr 16, 2019 at 7:57:22 pm

Hi Kalleheikki,

Thanks so much for your help. I've fiddled more, based on your suggestion, and I found a solution that works-ish, though I admit I don't understand exactly WHY it works. I don't understand why steps 4-7 below (dealing with the Anchor Point) are required at all. I imagine there's a simpler set of steps for this, but I haven't found them yet.

1. Create a duplicate of the original footage and set the scale to -100,100. This will flip the footage.
2. On the flipped footage, draw the mask on the clean side of the lip, choose Track Mask, and then run the tracker. Doing this will make sure the clean side of the lip stays within the mask at all times.
3. Now, open the Tracker, choose Track Motion, and choose the original footage as the source. Choose Transform with Position and Rotation, and track both sides of the lip. Click Edit Target and choose the flipped footage as the target. Click Apply. This will add key frames to the flipped footage’s Position field. (the problem still isn’t fixed after this step — not sure why)
4. Add a Point Control to the flipped footage. We’re going to use this to store an offset for the Anchor Point.
5. On the flipped footage, hold Alt and click the stopwatch next to Anchor Point to open the expressions field for the Anchor Point.
6. We’re ALSO going to connect the Anchor Point to the tracker data. Connect the Anchor Point to the Feature Center for the tracker from the original footage, and add (sum) the Point Control offset to the coordinates: thisComp.layer(“").motionTracker("Tracker 1")("Track Point 1").featureCenter + effect("Point Control")("Point”);
7. Adjust the Point Control offset so that the small flipped footage piece (the clean side of the lip) is atop the other side of the lip in the original footage.
8. When you hit play, it will stay in place, kind of. It’s not perfect.