作为一个起点,我推荐使用基本的图像相减,然后从那里。
的基本算法是:
firstFrame = readFrame()
firstFrameGrey = convertToGreyScale(firstFrame) // makes the image B&W
while True
secondFrame = readFrame()
secondFrameGrey = convertToGreyScale(secondFrame)
difference = sub(firstFrameGrey, secondFrameGrey)
threshold()
// perform some morphological operations
erosion()
dilation()
findContours()
// loop over contours and try filtering based off of area, perimeter etc.
// This filtration will allow you to detect significant changes.
// update frame
firstFrameGrey = secondFrameGrey
对于形态学操作,试验不同的值,看看什么样的结果你。在thresholding
This教程
更多信息说明如何执行的形态学操作。
轮廓信息可以与area API
的算法应该是自我解释和OpenCV拥有所有我命名方法一起找到here。
如果我理解正确的,你想使用视频处理框架来检测运动,但没有视频? – eshirima
是的。基本上我需要通过一个窗口来检测运动。我没有使用视频。我只需要触发我的设备在检测到运动时从睡眠模式进入唤醒模式。 –
我不认为它可能实现你想要的。你需要某种形式的输入或传感器饲料的运行一些分析,以确定运动或不..如果你不希望使用视频,然后用某种[运动传感器](https://www.safewise.com/resources/motion-sensor-guide)。 – eshirima