From 3d6409d86b7b80346e6c344dc92c0003a12215a3 Mon Sep 17 00:00:00 2001 From: Sebastian Hahta <joseha@utu.fi> Date: Wed, 4 Sep 2019 11:35:57 +0300 Subject: [PATCH] documentation on the interface --- components/rgbd-sources/include/ftl/rgbd/frame.hpp | 11 ++++++++--- .../rgbd-sources/src/algorithms/fixstars_sgm.cpp | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/rgbd-sources/include/ftl/rgbd/frame.hpp b/components/rgbd-sources/include/ftl/rgbd/frame.hpp index 993b49aa5..a2ec21789 100644 --- a/components/rgbd-sources/include/ftl/rgbd/frame.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/frame.hpp @@ -71,9 +71,14 @@ public: * @param Channel type * @returns Reference to channel data * - * Returns non-const reference to channel data. Invalidates other copies of - * the data (host/gpu) for the specified channel, next time getChannel() is - * called a memory transfer may occur. + * Returns non-const reference to channel memory. Invalidates other copies + * of the data (host/gpu) for the specified channel, next time getChannel() + * is called a memory transfer may occur. + * + * NOTE: If user of setChannel<T>() wants to modify contents instead of + * replacing them, getChannel<T>() needs to be called first to + * ensure there is valid contents in the returned reference! + * (TODO: interface could be improved) */ template <typename T> T& setChannel(const ftl::rgbd::channel_t& channel); diff --git a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp index 2fe64b3c5..0d8cfa877 100644 --- a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp +++ b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp @@ -118,6 +118,7 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream) #ifdef HAVE_OPTFLOW if (use_off_) { + frame.getChannel<Mat>(ftl::rgbd::kChanDisparity); off_.filter(frame.setChannel<Mat>(ftl::rgbd::kChanDisparity), Mat(lbw_)); } #endif -- GitLab