Skip to content

Instantly share code, notes, and snippets.

@spikedrba
Created May 12, 2015 17:53
Show Gist options
  • Save spikedrba/6f4e9c264d5fadceb33d to your computer and use it in GitHub Desktop.
Save spikedrba/6f4e9c264d5fadceb33d to your computer and use it in GitHub Desktop.
Motion vectors captures with picamera for testing
#!/usr/bin/env python
import picamera
from time import sleep
with picamera.PiCamera() as c:
c.resolution = (640, 480)
c.framerate = 15
c.vflip = True
c.start_preview()
print "Beginning testing, get in position"
sleep(2)
print "Test with no move... stand still!"
c.start_recording('motion-nomove.h264', motion_output='motion-nomove.data')
c.wait_recording(10)
c.stop_preview()
c.stop_recording()
print "Sleeping 2s.."
sleep(2)
print "Test with little movement... wave and smile"
c.start_preview()
c.start_recording('motion-littlemove.h264', motion_output='motion-littlemove.data')
c.wait_recording(10)
c.stop_preview()
c.stop_recording()
print "Sleeping 2s.."
sleep(2)
print "Test with lots of movement... dance like there's no tomorrow!"
c.start_preview()
c.start_recording('motion-lotmove.h264', motion_output='motion-lotmove.data')
c.wait_recording(10)
c.stop_preview()
print "Done!"
c.stop_recording()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment