From 174f64df0edc1a05c159398da3a251aacc5587ef Mon Sep 17 00:00:00 2001 From: Sebastian Hahta <joseha@utu.fi> Date: Thu, 19 Dec 2019 11:49:59 +0200 Subject: [PATCH] unpack calibration --- python/ftl/ftlstream.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/ftl/ftlstream.py b/python/ftl/ftlstream.py index d54a43589..c3790ac54 100644 --- a/python/ftl/ftlstream.py +++ b/python/ftl/ftlstream.py @@ -195,13 +195,14 @@ class FTLStreamReader: ''' Update calibration. ''' if p.codec == ftl.codec_t.MSGPACK: - # TODO: What is in (unpacked) p.data[1:]? Contents discarded at the moment - self._calibration[sp.streamID] = ftl.Camera._make(msgpack.unpackb(p.data)[0]) - + # TODO: channel and capabilities should be saved as well + calib, channel, capabilities = msgpack.unpackb(p.data) + self._calibration[sp.streamID] = ftl.Camera._make(calib) + elif p.codec == ftl.codec_t.CALIBRATION: calibration = struct.unpack("@ddddIIdddd", p.data[:(4*8+2*4+4*8)]) self._calibration[sp.streamID] = ftl.Camera._make(calibration) - + else: raise Exception("Unknown codec %i for calibration" % p.codec) @@ -363,7 +364,7 @@ class FTLStreamReader: raise ValueError("source id %i not found" % source) def get_Q(self, source): - ''' Disparity to depth matrix in OpenCV format ''' + ''' Disparity to depth matrix (OpenCV) ''' calib = self.get_calibration(source) Q = np.identity(4, dtype=np.float64) -- GitLab