Building an interactive object tracker
A colorspace-based tracker gives us the freedom to track a colored object, but we are also constrained to a predefined color. What if we just want to pick an object at random? How do we build an object tracker that can learn the characteristics of the selected object and just track it automatically? This is where the continuously-adaptive meanshift (CAMShift) algorithm comes into picture. It's basically an improved version of the meanshift algorithm.
The concept of meanshift is actually nice and simple. Let's say we select a region of interest and we want our object tracker to track that object. In this region, we select a bunch of points based on the color histogram and we compute the centroid of spatial points. If the centroid lies at the center of this region, we know that the object hasn't moved. But if the centroid is not at the center of this region, then we know that the object is moving in some direction. The movement of the centroid controls...