From 052a9154c4a9b247822c1c7720a6a71608e2ff63 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Thu, 12 Sep 2019 12:07:52 +0300 Subject: [PATCH] Move frameset --- .../rgbd-sources/include/ftl/rgbd/frame.hpp | 1 + .../include/ftl/rgbd/frameset.hpp | 32 +++++++++++++++++++ .../rgbd-sources/include/ftl/rgbd/group.hpp | 18 ++--------- 3 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 components/rgbd-sources/include/ftl/rgbd/frameset.hpp diff --git a/components/rgbd-sources/include/ftl/rgbd/frame.hpp b/components/rgbd-sources/include/ftl/rgbd/frame.hpp index 227913e5d..4d7aba6b3 100644 --- a/components/rgbd-sources/include/ftl/rgbd/frame.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/frame.hpp @@ -12,6 +12,7 @@ namespace rgbd { typedef unsigned int channel_t; static const channel_t kChanNone = 0; +static const channel_t kChanColour = 0x0001; static const channel_t kChanLeft = 0x0001; // CV_8UC3 static const channel_t kChanDepth = 0x0002; // CV_32FC1 static const channel_t kChanRight = 0x0004; // CV_8UC3 diff --git a/components/rgbd-sources/include/ftl/rgbd/frameset.hpp b/components/rgbd-sources/include/ftl/rgbd/frameset.hpp new file mode 100644 index 000000000..93839efda --- /dev/null +++ b/components/rgbd-sources/include/ftl/rgbd/frameset.hpp @@ -0,0 +1,32 @@ +#ifndef _FTL_RGBD_FRAMESET_HPP_ +#define _FTL_RGBD_FRAMESET_HPP_ + +#include <ftl/rgbd/frame.hpp> + +#include <opencv2/opencv.hpp> +#include <vector> + +namespace ftl { +namespace rgbd { + +class Source; + +/** + * Represents a set of synchronised frames, each with two channels. This is + * used to collect all frames from multiple computers that have the same + * timestamp. + */ +struct FrameSet { + int64_t timestamp; // Millisecond timestamp of all frames + std::vector<Source*> sources; // All source objects involved. + std::vector<ftl::rgbd::Frame> frames; + std::atomic<int> count; // Number of valid frames + std::atomic<unsigned int> mask; // Mask of all sources that contributed + bool stale; // True if buffers have been invalidated + SHARED_MUTEX mtx; +}; + +} +} + +#endif // _FTL_RGBD_FRAMESET_HPP_ diff --git a/components/rgbd-sources/include/ftl/rgbd/group.hpp b/components/rgbd-sources/include/ftl/rgbd/group.hpp index 000eea0ae..e4ffb5984 100644 --- a/components/rgbd-sources/include/ftl/rgbd/group.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/group.hpp @@ -3,6 +3,8 @@ #include <ftl/threads.hpp> #include <ftl/timer.hpp> +#include <ftl/rgbd/frame.hpp> +#include <ftl/rgbd/frameset.hpp> #include <opencv2/opencv.hpp> #include <vector> @@ -12,22 +14,6 @@ namespace rgbd { class Source; -/** - * Represents a set of synchronised frames, each with two channels. This is - * used to collect all frames from multiple computers that have the same - * timestamp. - */ -struct FrameSet { - int64_t timestamp; // Millisecond timestamp of all frames - std::vector<Source*> sources; // All source objects involved. - std::vector<cv::Mat> channel1; // RGB - std::vector<cv::Mat> channel2; // Depth (usually) - std::atomic<int> count; // Number of valid frames - std::atomic<unsigned int> mask; // Mask of all sources that contributed - bool stale; // True if buffers have been invalidated - SHARED_MUTEX mtx; -}; - // Allows a latency of 20 frames maximum static const size_t kFrameBufferSize = 20; -- GitLab