Ask Your Question

Revision history [back]

You can find the gravity center by computed a mean of all pixels in your blob. Or, you could ask OpenCV doing it for you:

  1. Find the contours (your blob) with findContours
  2. Fit an ellipse around your biggest contours (usually your person) with fitEllipse

The center of ellipse is your center of gravity, that you can track, maybe using the Kalman filter to smooth motion.

You could also look at OpenCV background subtraction classes here.