Amount of movement detection

Hi, I’m new to OpenMV and am just wanting to use my M7 for simple detection of the amount of movement in the frame. I’ve done this before using various applications on my laptop through ongoing frame differencing (subtracting the current frame from the previous frame in continuous manner) that produces an outline around the moving image, the thickness of which is proportional to the amount of movement. The overall brightness of the frame reflects how thick the outlines are and is proportional to the amount of movement.
I’ve looked through the frame differencing examples in the IDE but can only find background subtraction referencing a snapshot rather than ongoing stream of ‘previous frame’ if that makes sense. Any help on this is much appreciated.

Hi, see the advanced frame differencing example. It blends the current frame into a temp buffer at a certain rate.

Thanks Kwagyeman,
that seems to do the job, though there is quite a lot of what seems to be background static when nothing is moving. I really want to detect subtle movement but can’t overcome the low level tremor that I can see on the histogram. The camera view seems completely dark which is correct so why is there a signal on the histogram?

It’s going to find the +/-1 bit differences. You need to filter the output of get_stats() or get_histogram().