5
5
import os
6
6
import inspect
7
7
import warnings
8
+ import time
8
9
9
10
_viewer_dir = os .path .dirname (inspect .getfile (inspect .currentframe ()))
10
11
if ~ os .path .isabs (_viewer_dir ):
@@ -341,7 +342,7 @@ def play(self, poses, ts=[], tlim=[-numpy.inf, numpy.inf], repeat=False,
341
342
self .__send (msg )
342
343
343
344
def record (self , folder , poses , ts = [], tlim = [- numpy .inf , numpy .inf ],
344
- interp = 'cubic_natural' , shutter_speed = numpy . inf , fps = 24 ,
345
+ interp = 'cubic_natural' , shutter_speed = None , fps = 24 ,
345
346
prefix = 'frame_' , ext = 'png' ):
346
347
"""
347
348
@@ -354,6 +355,7 @@ def record(self, folder, poses, ts=[], tlim=[-numpy.inf, numpy.inf],
354
355
ts: Same as in :meth:`pptk.viewer.play`
355
356
tlim: Same as in :meth:`pptk.viewer.play`
356
357
interp: Same as in :meth:`pptk.viewer.play`
358
+ shutter_speed (optional): Time before capturing
357
359
fps: Frames per second
358
360
prefix: Resulting image file names are prefixed with this string
359
361
ext: Image format
@@ -398,6 +400,9 @@ def record(self, folder, poses, ts=[], tlim=[-numpy.inf, numpy.inf],
398
400
struct .pack ('2f' , t , t ) + \
399
401
struct .pack ('?' , False )
400
402
self .__send (msg )
403
+ # give viewer time to finish rendering
404
+ if shutter_speed is not None :
405
+ time .sleep (shutter_speed )
401
406
filename = prefix \
402
407
+ ('%0' + str (num_digits ) + 'd' ) % (i + 1 ) + '.' + ext
403
408
filename = os .path .join (folder , filename )
0 commit comments