Skip to content

Commit

Permalink
Add shutter_speed/wait before capture in record.
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Flo Roeske <[email protected]>
  • Loading branch information
floroeske committed Mar 25, 2020
1 parent 697c09a commit fd6c404
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pptk/viewer/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import inspect
import warnings
import time

_viewer_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
if ~os.path.isabs(_viewer_dir):
Expand Down Expand Up @@ -354,6 +355,7 @@ def record(self, folder, poses, ts=[], tlim=[-numpy.inf, numpy.inf],
ts: Same as in :meth:`pptk.viewer.play`
tlim: Same as in :meth:`pptk.viewer.play`
interp: Same as in :meth:`pptk.viewer.play`
shutter_speed: Time before capturing
fps: Frames per second
prefix: Resulting image file names are prefixed with this string
ext: Image format
Expand Down Expand Up @@ -398,6 +400,9 @@ def record(self, folder, poses, ts=[], tlim=[-numpy.inf, numpy.inf],
struct.pack('2f', t, t) + \
struct.pack('?', False)
self.__send(msg)
# give viewer time to finish render
if shutter_speed != numpy.inf:
time.sleep(shutter_speed)
filename = prefix \
+ ('%0' + str(num_digits) + 'd') % (i + 1) + '.' + ext
filename = os.path.join(folder, filename)
Expand Down

0 comments on commit fd6c404

Please sign in to comment.