Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Past ten frame retrieval from a webcam

I have a Python/Opencv2 security camera application that detects movement from a live feed. When a detection is triggered I want to be able to save the last ten frames pria to detection, the detected frames and ten frames following detection as jpgs to a specified folder.

I'm not too sure on how to do this, but would a constantly updating "one in" and "one out" Python frame array be the way to go?

The user could specify to save 10 frames pria, and say 10 frames post detection. Then the frame array would have to constantly store the last 10 frames (frames as a numpy array). Then following detection expand to the detected frames and the user specified post detection number of frames.

Once detection is finished, and the code has added the user specified number of post frames into the array, the array could be emptied, converted to jpgs, and saved to a specified folder.

The array would not be totally emptied, it would always need to contain the pre specified number of frames, just in case of a detection quickly after the first detection.

1) Does this make sense and sound like a valid approach? 2) How can I save a numpy array into a Python array, in effect an array of arrays? 3) Could someone point me towards some opencv2 and python code that does something similar, so I can have a look?