The face_tracking_correlation_filters.py script can be modified to track an arbitrary object. In this case, we will use the mouse to select the object to track. If we press 1, the algorithm will start tracking the object inside the pre-defined bounding box. Additionally, if we press 2, the pre-defined bounding box will be emptied and the tracking algorithm will be stopped, allowing the user to select another bounding box.
To clarify how the face_tracking_correlation_filters.py script works, we have included the next two screenshots. In the first one, we can see that we need to select a bounding box to start the tracking:
In the second one, we can see the output of an arbitrary frame when the algorithm is tracking the object:
As you can see in the previous screenshot, the algorithm is tracking the object inside the bounding box.