Colorspace based tracking
Frame differencing gives us some useful information, but we cannot use it to build anything meaningful. In order to build a good object tracker, we need to understand what characteristics can be used to make our tracking robust and accurate. So, let's take a step in that direction and see how we can use color spaces to come up with a good tracker. As we have discussed in previous chapters, HSV color space is very informative when it comes to human perception. We can convert an image to the HSV space, and then use color space thresholding to track a given object.
Consider the following frame in the video:
If you run it through the color space filter and track the object, you will see something like this:
As we can see here, our tracker recognizes a particular object in the video, based on the color characteristics. In order to use this tracker, we need to know the color distribution of our target object. The following is the code:
import cv2 import numpy as np if...