如何使用opencv检测短图像序列中的移动物体?

How to detect a moving object in a short sequence of images using opencv?

我有一小段灰度图像(20 张图像),它们是从相机收集的连续帧。我需要在每个图像中识别一个小移动物体的位置。我尝试过使用背景减法,并且可以识别每个图像中的移动像素。我怎样才能继续检测那个移动物体的确切位置?

你可以这样试试

(1)第一次使用模板匹配找到对象

https://docs.opencv.org/3.0-beta/doc/tutorials/imgproc/histograms/template_matching/template_matching.html?highlight=template%20matching

(2) 使用camshift或其他跟踪算法跟踪对象。 https://github.com/opencv/opencv/blob/master/samples/python/camshift.py