We have applied the mean-shift algorithm on the saliency map for tracking salient objects. Surely, not all the objects in the world are salient, so we can't use that approach for tracking any object. As mentioned previously, we could also use an HSV histogram in combination with the mean-shift algorithm to track objects. The latter does not require a saliency map—if a region is selected, that approach will try to track selected objects throughout the consequent frames.
In this section, we will create a script that is able to track an object throughout a video using the tracking algorithms available in OpenCV. All these algorithms have the same API and are referred to collectively as the OpenCV Tracking API. These algorithms track single objects—once the initial bounding box is provided to the algorithm, it will...