Function calculate_overlap

Calculates overlap for two trajectories

The function calculates per-frame overlap between two trajectories. Besides the region overlap the function also returns cointainment of the second trajectory in the first and containment of the first trajectory in the second.

If the trajectories are not of equal length, then the overlaps are calculated up to the end of the shorter one.

Input:

Output: