diff --git a/components/rgbd-sources/src/snapshot_source.cpp b/components/rgbd-sources/src/snapshot_source.cpp index 030e56dd48bf48bf351917274e2f26cc0e414cd3..aa5268549bbf32de9a311a93e39aeed5e6a13555 100644 --- a/components/rgbd-sources/src/snapshot_source.cpp +++ b/components/rgbd-sources/src/snapshot_source.cpp @@ -15,7 +15,10 @@ using std::vector; SnapshotSource::SnapshotSource(ftl::rgbd::Source *host, SnapshotReader &reader, const string &id) : detail::Source(host) { Eigen::Matrix4d pose; - reader.getCameraRGBD(id, rgb_, depth_, pose, params_); + reader.getCameraRGBD(id, snap_rgb_, snap_depth_, pose, params_); + + rgb_ = snap_rgb_; + depth_ = snap_depth_; if (rgb_.empty()) LOG(ERROR) << "Did not load snapshot rgb - " << id; if (depth_.empty()) LOG(ERROR) << "Did not load snapshot depth - " << id; @@ -50,3 +53,9 @@ SnapshotSource::SnapshotSource(ftl::rgbd::Source *host, SnapshotReader &reader, host->setPose(pose); } + +bool SnapshotSource::compute(int n, int b) { + snap_rgb_.copyTo(rgb_); + snap_depth_.copyTo(depth_); + return true; +} diff --git a/components/rgbd-sources/src/snapshot_source.hpp b/components/rgbd-sources/src/snapshot_source.hpp index abc8fd76bb56d9790bb7af6e5098fab80120b8b7..eb4e58594323b7f1167976b13d8d46c6b96c8fd0 100644 --- a/components/rgbd-sources/src/snapshot_source.hpp +++ b/components/rgbd-sources/src/snapshot_source.hpp @@ -17,11 +17,13 @@ class SnapshotSource : public detail::Source { SnapshotSource(ftl::rgbd::Source *, ftl::rgbd::SnapshotReader &reader, const std::string &id); ~SnapshotSource() {}; - bool compute(int n, int b) override { return true; }; + bool compute(int n, int b); bool isReady() { return true; } //void reset(); - + private: + cv::Mat snap_rgb_; + cv::Mat snap_depth_; }; } diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index 4a3b7093ba8a4a5863c67dc51693cdbe1276c1b4..913fe4acb53afb28b63c6e89d97e50dca6a669b6 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -165,18 +165,18 @@ ftl::rgbd::detail::Source *Source::_createDeviceImpl(const ftl::URI &uri) { void Source::getFrames(cv::Mat &rgb, cv::Mat &depth) { SHARED_LOCK(mutex_,lk); - //rgb_.copyTo(rgb); - //depth_.copyTo(depth); + rgb_.copyTo(rgb); + depth_.copyTo(depth); //rgb = rgb_; //depth = depth_; - cv::Mat tmp; + /*cv::Mat tmp; tmp = rgb; rgb = rgb_; rgb_ = tmp; tmp = depth; depth = depth_; - depth_ = tmp; + depth_ = tmp;*/ } Eigen::Vector4d Source::point(uint ux, uint uy) {