0
$\begingroup$

I have motion tracked an object in a video clip, and in the compositor using an Image input node, a Tracker node X & Y feeding into a Translate node's X & Y to have the image superimposed on top of the tracked object. This follows the method shown in https://www.youtube.com/watch?v=qleJ7dw6xNY .

Now I also want the image's rotation to match the tracked object, by adding a Rotate node, and somehow feeding the rotation of the marker(s) into it.

I am using Location+Rotation tracking for one track, and I can see that the marker's rotation follows the object's rotation. But there does not seem to be a way to extract that rotation from the marker to use in the compositor node graph.

I have also tried using two separate tracking points on opposite ends of the object, in the hopes that I can use the angle of the line between them for the rotation. However, I cannot see an obvious way to "get the angle between trackers" in the compositor.

I can manually get the coordinates of the two trackers, and use Math nodes (diff, arcsin/cos) to compute the angle, but I was hoping there was a more built-in way that I'm just missing.

$\endgroup$
1
  • $\begingroup$ I've got the 2-tracker-manual-calculation solution working. Will post it as the answer if I don't get a better one. $\endgroup$ May 30, 2023 at 21:27

1 Answer 1

0
$\begingroup$

This example node group takes in two X,Y coordinates (e.g., the output of two Track Position nodes), and outputs the angle between them, (in the range -180 to 180 degrees). The basic math is:

deltaX = X1-X2
deltaY = Y1-Y2
distance = sqrt(deltaX^2 + deltaY^2)
angle = arccos(deltaX/distance) if deltaY is positive, -arccos(deltaX/distance) if deltaY is negative.

node screenshot

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .