55import os
66import inspect
77import warnings
8+ import time
89
910_viewer_dir = os .path .dirname (inspect .getfile (inspect .currentframe ()))
1011if ~ os .path .isabs (_viewer_dir ):
@@ -341,7 +342,7 @@ def play(self, poses, ts=[], tlim=[-numpy.inf, numpy.inf], repeat=False,
341342 self .__send (msg )
342343
343344 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 ,
345346 prefix = 'frame_' , ext = 'png' ):
346347 """
347348
@@ -354,6 +355,7 @@ def record(self, folder, poses, ts=[], tlim=[-numpy.inf, numpy.inf],
354355 ts: Same as in :meth:`pptk.viewer.play`
355356 tlim: Same as in :meth:`pptk.viewer.play`
356357 interp: Same as in :meth:`pptk.viewer.play`
358+ shutter_speed (optional): Time before capturing
357359 fps: Frames per second
358360 prefix: Resulting image file names are prefixed with this string
359361 ext: Image format
@@ -398,6 +400,9 @@ def record(self, folder, poses, ts=[], tlim=[-numpy.inf, numpy.inf],
398400 struct .pack ('2f' , t , t ) + \
399401 struct .pack ('?' , False )
400402 self .__send (msg )
403+ # give viewer time to finish rendering
404+ if shutter_speed is not None :
405+ time .sleep (shutter_speed )
401406 filename = prefix \
402407 + ('%0' + str (num_digits ) + 'd' ) % (i + 1 ) + '.' + ext
403408 filename = os .path .join (folder , filename )
0 commit comments