Summary
This chapter has dealt with video analysis and, in particular, a selection of useful techniques for tracking objects.
We began by learning about background subtraction with a basic motion detection technique that calculates frame differences. Then, we moved on to more complex and efficient background subtraction algorithms – namely, MOG and KNN – which are implemented in OpenCV's cv2.BackgroundSubtractor
class.
We then proceeded to explore the MeanShift and CamShift tracking algorithms, using color histograms and back-projections. We also familiarized ourselves with the Kalman filter and its usefulness in smoothing the results of a tracking algorithm. Then, we put all of our knowledge together in a sample surveillance application, which is capable of tracking pedestrians (or other moving objects) in a video.
Finally, we saw that we can easily replace one set of tracking techniques with another, in our object-oriented implementation of a pedestrian tracker. We...