Skip to content
Snippets Groups Projects

feature/frame class

Merged Sebastian Hahta requested to merge feature/stereovideo-refactor into master
Files
9
@@ -12,25 +12,32 @@ namespace rgbd {
typedef unsigned int channel_t;
static const channel_t kChanNone = 0;
static const channel_t kChanLeft = 0x0001;
static const channel_t kChanDepth = 0x0002;
static const channel_t kChanRight = 0x0004;
static const channel_t kChanDisparity = 0x0008;
static const channel_t kChanLeft = 0x0001; // CV_8UC3
static const channel_t kChanDepth = 0x0002; // CV_32FC1
static const channel_t kChanRight = 0x0004; // CV_8UC3
static const channel_t kChanDisparity = 0x0008; // CV_32FC1
static const channel_t kChanDeviation = 0x0010;
static const channel_t kChanNormals = 0x0020;
static const channel_t kChanConfidence = 0x0040;
static const channel_t kChanFlow = 0x0080;
static const channel_t kChanFlow = 0x0080; // CV_16SC2 (format 10.5) from NVOF
static const channel_t kChanEnergy = 0x0100;
// should l/r gray be removed (not that expensive to re-calculate if needed)?
static const channel_t kChanLeftGray = 0x0200; // CV_8UC1
static const channel_t kChanRightGray = 0x0400; // CV_8UC1
static const channel_t kChanOverlay1 = 0x1000;
// maximum number of available channels
static const unsigned int n_channels = 11;
static const unsigned int n_channels = 13;
inline bool isFloatChannel(ftl::rgbd::channel_t chan) {
return (chan == ftl::rgbd::kChanDepth || chan == ftl::rgbd::kChanEnergy);
}
// TODO: interpolation for scaling depends on channel type;
// NN for depth/disparity/optflow, linear/cubic/etc. for RGB
class Frame;
class Frame {
@@ -56,6 +63,7 @@ public:
/* @brief Method to get reference to the channel content
* @param Channel type
* @param CUDA stream
* @returns Const reference to channel data
*
* Result is valid only if hasChannel() is true. Host/Gpu transfer is
@@ -63,10 +71,9 @@ public:
* changed by calling setChannel(). Return value valid only if
* hasChannel(channel) is true.
*/
template <typename T> const T& getChannel(const ftl::rgbd::channel_t& channel, cv::cuda::Stream& stream);
template <typename T> const T& getChannel(const ftl::rgbd::channel_t& channel);
/* @brief Method to set/modify channel content
* @param Channel type
* @returns Reference to channel data
@@ -98,6 +105,8 @@ private:
case kChanConfidence: return 7;
case kChanFlow: return 8;
case kChanEnergy: return 9;
case kChanLeftGray: return 11;
case kChanRightGray: return 12;
// should not happen (error); returned index is kChanNone
default: return 0;
}
@@ -113,9 +122,13 @@ private:
std::vector<uint> available_;
};
template<> const cv::Mat& Frame::getChannel(const ftl::rgbd::channel_t& channel, cv::cuda::Stream& stream);
template<> const cv::cuda::GpuMat& Frame::getChannel(const ftl::rgbd::channel_t& channel, cv::cuda::Stream& stream);
template<> const cv::Mat& Frame::getChannel(const ftl::rgbd::channel_t& channel);
template<> cv::Mat& Frame::setChannel(const ftl::rgbd::channel_t& channel);
template<> const cv::cuda::GpuMat& Frame::getChannel(const ftl::rgbd::channel_t& channel);
template<> cv::Mat& Frame::setChannel(const ftl::rgbd::channel_t& channel);
template<> cv::cuda::GpuMat& Frame::setChannel(const ftl::rgbd::channel_t& channel);
}
Loading