diff --git a/components/rgbd-sources/include/ftl/rgbd/frame.hpp b/components/rgbd-sources/include/ftl/rgbd/frame.hpp index 227913e5de056f15380390201da96b66ec23e27f..4d7aba6b30136aa29018479ddbd72302cab31ed8 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 0000000000000000000000000000000000000000..93839efda9c6dc8cfe53e6775293949d5c1747e8 --- /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 000eea0ae60303d816e09298613ddc30f0a8146a..e4ffb5984e625b1b9859a3f193a7f4b44c956684 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;