Skip to content

Commit

Permalink
Fix #81: Calibration didnt passed to captures received in playback mo…
Browse files Browse the repository at this point in the history
…dule (#82)

* Fix #81: Calibration didnt passed to captures received in playback module

* Add comment

* Small fix to k4a_module

* Experiment with cache

* Experiment with cache

* Remove warning

* Add debug messages

* More logging

* Revert module changes

* test

* Debug

* Revert changes

* Revert changes

* Formatter
  • Loading branch information
shagren authored Nov 18, 2020
1 parent 6d1355a commit 89ba085
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyk4a/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get_next_capture(self):
result, capture_handle = k4a_module.playback_get_next_capture(self._handle, self.thread_safe)
self._verify_stream_error(result)
return PyK4ACapture(
calibration=self._calibration,
calibration=self.calibration,
capture_handle=capture_handle,
color_format=self.configuration["color_format"],
thread_safe=self.thread_safe,
Expand All @@ -166,7 +166,7 @@ def get_previouse_capture(self):
result, capture_handle = k4a_module.playback_get_previous_capture(self._handle, self.thread_safe)
self._verify_stream_error(result)
return PyK4ACapture(
calibration=self._calibration,
calibration=self.calibration,
capture_handle=capture_handle,
color_format=self.configuration["color_format"],
thread_safe=self.thread_safe,
Expand Down
21 changes: 21 additions & 0 deletions tests/functional/test_playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,24 @@ def test_seek_by_device_time(playback: PyK4APlayback):
playback.seek(1, origin=SeekOrigin.DEVICE_TIME) # TODO add correct timestamp from datablock here
capture = playback.get_next_capture()
assert capture.color is not None


class TestGetCapture:
@staticmethod
def test_get_next_capture(playback: PyK4APlayback):
playback.open()
capture = playback.get_next_capture()
assert capture is not None
assert capture.depth is not None
assert capture.color is not None
assert capture._calibration is not None # Issue #81

@staticmethod
def test_get_previouse_capture(playback: PyK4APlayback):
playback.open()
playback.seek(0, origin=SeekOrigin.END)
capture = playback.get_previouse_capture()
assert capture is not None
assert capture.depth is not None
assert capture.color is not None
assert capture._calibration is not None # Issue #81

0 comments on commit 89ba085

Please sign in to comment.