Object detection with centroid-based tracking