jimmie
September 1, 2019, 8:34am
1
I have been testing the “Snapshot on Movement” example outdoors.
The program works but the snapshot is executed after a relatively long time even though the motion itself is very pronounced (big object passing in front of lens).
How can I execute a snapshot IMMEDIATELY upon detecting a pronounced motion?
Thanks in advance.
The example saves the image after detecting 10 frames of motion, try this:
while(True):
img = sensor.snapshot()
img.difference("temp/bg.bmp")
stats = img.statistics()
if (stats[5] > 20):
img.save("temp/snapshot-%d.jpg" % pyb.rng()) # Save Pic.
jimmie
September 1, 2019, 4:49pm
3
The example saves the image after detecting 10 frames of motion, try this:
while(True):
img = sensor.snapshot()
img.difference("temp/bg.bmp")
stats = img.statistics()
if (stats[5] > 20):
img.save("temp/snapshot-%d.jpg" % pyb.rng()) # Save Pic.
Thank you Ibrahim.
Does the example show 10 frames or 20?
The example waits until it counts 10 frames where motion is detected. The 20 is a threshold for the difference.
diff = 10 # We'll say we detected motion after 10 frames of motion.
Unable to Capture Snapshots “OSError: Failed to write requested bytes!”. What could be the possible Reasons?
Don’t write pictures to the internal flash. Please use an SD card. The internal flash is very small.