Skip to content

Commit a85a3df

Browse files
committed
Add shutter_speed/wait before capture in record.
The rendering needs some time to settle after moving the camera. This adds a sleep after moving to the next camera position and before capturing.
1 parent 697c09a commit a85a3df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pptk/viewer/viewer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import inspect
77
import warnings
8+
import time
89

910
_viewer_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
1011
if ~os.path.isabs(_viewer_dir):
@@ -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: 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 render
404+
if shutter_speed != numpy.inf:
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

Comments
 (0)