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. In the course of this, we talked about color histograms and back-projections. We also familiarized ourselves with the Kalman filter and its usefulness in smoothing the results of a tracking algorithm. Finally, 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.
By now...