diff --git a/components/rgbd-sources/include/ftl/rgbd/frame.hpp b/components/rgbd-sources/include/ftl/rgbd/frame.hpp index 993b49aa57b0eb76d4ef99a42c71869c6ac2d645..a2ec2178987f1d2c0a3ec3a291318f9df34c9f13 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 2fe64b3c535a06665227ed33d1cec6f8d2ff8b8f..0d8cfa877e730b0b9b7e847eb2f4cf09a524fc86 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