indexpage

master
giulia 8 years ago
parent 5eaff2a1e5
commit f2d9e1bc38

@ -33,10 +33,10 @@ print "Content-type: text/html"
print "" print ""
print Template(u"""<html> print Template(u"""<html>
<head> <head>
<title>RECORD O RAMA</title> <title>ADOPT A WALK</title>
<style type="text/css"> <style type="text/css">
div.movie { div.movie {
border: 5px solid pink; border: 20px solid black;
display: inline-block; display: inline-block;
} }
div.movie img { div.movie img {
@ -45,15 +45,18 @@ div.movie img {
</style> </style>
</head> </head>
<body> <body>
<header>
<p>head<p>
<img src="../images/header.png" width="100%"/>
</header>
{% for i in items %}
<div class="movie"><a href="../clips/{{i.mp4}}"><img src="../clips/{{i.jpg}}" /></a> </div>
{% endfor %}
{% for i in items %} <div>
<div class="movie"><a href="../clips/{{i.mp4}}"><img src="../clips/{{i.jpg}}" /></a> </div>
{% endfor %}
<div> </div>
</body>
</div>
</body>
</html>""").render(items=items).encode("utf-8") </html>""").render(items=items).encode("utf-8")

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

@ -22,7 +22,7 @@ def draw(flow):
f[...,0] = 0 #np.minimum(v*10, 255) f[...,0] = 0 #np.minimum(v*10, 255)
f[...,1] = 0 f[...,1] = 0
f[...,2] = 255- np.minimum(v**2, 255) #ang*(180/np.pi/2) f[...,2] = 255- np.minimum(v**3, 255) #ang*(180/np.pi/2)
bgr = cv2.cvtColor(f, cv2.COLOR_HSV2BGR) bgr = cv2.cvtColor(f, cv2.COLOR_HSV2BGR)
return bgr return bgr
@ -35,7 +35,7 @@ p.add_argument("--height", type=int, default=480, help="pre-detect resize height
p.add_argument("--fourcc", default="XVID", help="MJPG,mp4v,XVID") p.add_argument("--fourcc", default="XVID", help="MJPG,mp4v,XVID")
p.add_argument("--framerate", type=float, default=25, help="output frame rate") p.add_argument("--framerate", type=float, default=25, help="output frame rate")
p.add_argument("--show", default=False, action="store_true") p.add_argument("--show", default=False, action="store_true")
p.add_argument("--time", type=float, default=None) p.add_argument("--frames", type=int, default=100)
args = p.parse_args() args = p.parse_args()
fourcc = None fourcc = None
@ -59,9 +59,8 @@ while True:
if prevgray.shape == (args.height, args.width): if prevgray.shape == (args.height, args.width):
break break
count = 0
try: try:
if args.time != None:
start = time.time()
while True: while True:
ret, frame = cam.read() ret, frame = cam.read()
@ -72,18 +71,19 @@ try:
if out != None: if out != None:
out.write(frame) out.write(frame)
count += 1
if args.show: if args.show:
cv2.imshow('display', frame) cv2.imshow('display', frame)
if cv2.waitKey(5) & 0xFF == ord('q'): if cv2.waitKey(5) & 0xFF == ord('q'):
break break
if args.time != None: if args.frames != None:
elapsed = time.time() - start if (count >= args.frames):
if (elapsed >= args.time):
break break
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
print ("\nCleaning up...") print ("\nCleaning up... Wrote", count, "frames")
if out: if out:
out.release() out.release()
if args.show: if args.show:

@ -31,6 +31,7 @@ if args.output:
else: else:
out = None out = None
count=0
try: try:
if args.time != None: if args.time != None:
start = time.time() start = time.time()
@ -38,6 +39,7 @@ try:
ret, frame = cam.read() ret, frame = cam.read()
if out != None: if out != None:
out.write(frame) out.write(frame)
count += 1
if args.show: if args.show:
cv2.imshow('display', frame) cv2.imshow('display', frame)
if cv2.waitKey(5) & 0xFF == ord('q'): if cv2.waitKey(5) & 0xFF == ord('q'):
@ -50,7 +52,7 @@ try:
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
print ("\nCleaning up...") print ("\nCleaning up... Wrote", count, "frames")
if out: if out:
out.release() out.release()
if args.show: if args.show:

@ -3,31 +3,85 @@ espeak "Gait analysis number one." -v en
sleep 1 sleep 1
espeak "Please state your name:" -v en espeak "Please state your name:" -v en
sleep 1
espeak "Position yourself 2 to 3 meters away from the Tetra Gamma Circulaire." -v en
sleep 2 sleep 2
espeak "Walk towards the Tetra Gamma Circulaire in a straight line ." -v en
sleep 0.2
play sweep_up.wav
basename=clips/$(date +%Y-%m-%d-%H-%M-%S) basename=clips/$(date +%Y-%m-%d-%H-%M-%S)
echo recording $basename.avi... echo recording $basename.avi...
scripts/black2.py --output $basename.avi --time 3 scripts/black2.py --output $basename.avi --frames 50 --framerate 4 --width 320 --height 240
# convert to mp4 # convert to mp4
ffmpeg -i $basename.avi -y $basename.mp4 ffmpeg -i $basename.avi -y $basename.mp4
# make a thumnail image # make a thumnail image
ffmpeg -i $basename.avi -vframes 1 -ss 0.5 -y $basename.jpg ffmpeg -i $basename.avi -vframes 1 -ss 0.5 -y $basename.jpg
rm $basename.avi # rm $basename.avi
espeak "ciao ciao halo" -v en play sweep_up.wav
sleep 2
espeak "Position yourself one meter away to the left of the Tetra Gamma Circulaire." -v en
sleep 1
espeak "Walk from left to right in front of the Tetra Gamma Circulaire.
" -v en
sleep 0.2
play sweep_up.wav
basename=clips/$(date +%Y-%m-%d-%H-%M-%S)
echo recording $basename.avi...
scripts/black2.py --output $basename.avi --frames 50 --framerate 4 --width 320 --height 240
# convert to mp4
ffmpeg -i $basename.avi -y $basename.mp4
# make a thumnail image
ffmpeg -i $basename.avi -vframes 1 -ss 0.5 -y $basename.jpg
# rm $basename.avi
play sweep_up.wav
espeak "Turn your back to the Tetra Gamma Circulaire." -v en
sleep 1
espeak "Walk away from the Tetra Gamma Circulaire.
" -v en
sleep 0.2
play sweep_up.wav
basename=clips/$(date +%Y-%m-%d-%H-%M-%S) basename=clips/$(date +%Y-%m-%d-%H-%M-%S)
echo recording $basename.avi... echo recording $basename.avi...
scripts/black2.py --output $basename.avi --time 3 scripts/black2.py --output $basename.avi --frames 50 --framerate 4 --width 320 --height 240
# convert to mp4 # convert to mp4
ffmpeg -i $basename.avi -y $basename.mp4 ffmpeg -i $basename.avi -y $basename.mp4
# make a thumnail image # make a thumnail image
ffmpeg -i $basename.avi -vframes 1 -ss 0.5 -y $basename.jpg ffmpeg -i $basename.avi -vframes 1 -ss 0.5 -y $basename.jpg
rm $basename.avi # rm $basename.avi
play sweep_up.wav
espeak "Position yourself 2 to 3 meters away from the Tetra Gamma Circulaire." -v en
sleep 1
espeak "Walk towards the Tetra Gamma Circulaire on a zig zag line.
" -v en
sleep 0.2
play sweep_up.wav
basename=clips/$(date +%Y-%m-%d-%H-%M-%S)
echo recording $basename.avi...
scripts/black2.py --output $basename.avi --frames 50 --framerate 4 --width 320 --height 240
# convert to mp4
ffmpeg -i $basename.avi -y $basename.mp4
# make a thumnail image
ffmpeg -i $basename.avi -vframes 1 -ss 0.5 -y $basename.jpg
# rm $basename.avi
play sweep_up.wav
# subprocess.call(["espeak", "Please state your name:", "-v", "en"]) # subprocess.call(["espeak", "Please state your name:", "-v", "en"])
# sleep(2) # sleep(2)

Binary file not shown.
Loading…
Cancel
Save