Skip to content
Snippets Groups Projects
Commit 1615b0c4 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

disable optical flow (rescaling on CUDA missing)

parent a2292897
No related branches found
No related tags found
2 merge requests!105CUDA optical flow smoothing,!103feature/frame class
Pipeline #13356 failed
This commit is part of merge request !103. Comments created here will be created in the context of that merge request.
......@@ -12,22 +12,22 @@ 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_32FC2 or CV_16FC2 (fix)
static const channel_t kChanEnergy = 0x0100;
static const channel_t kChanLeftGray = 0x0200;
static const channel_t kChanRightGray = 0x0400;
//static const channel_t kChanLeftGray = 0x0200; // not used // CV_8UC1
//static const channel_t kChanRightGray = 0x0400; // not used // CV_8UC1
static const channel_t kChanOverlay1 = 0x1000;
// maximum number of available channels
static const unsigned int n_channels = 13;
static const unsigned int n_channels = 11;
inline bool isFloatChannel(ftl::rgbd::channel_t chan) {
return (chan == ftl::rgbd::kChanDepth || chan == ftl::rgbd::kChanEnergy);
......@@ -100,6 +100,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;
}
......
......@@ -61,13 +61,14 @@ void StereoVideoSource::init(const string &file)
frames_ = std::vector<Frame>(2);
#ifdef HAVE_OPTFLOW
// TODO could be calculated at later step too if have access to old frames
/*
use_optflow_ = host_->value("use_optflow", false);
LOG(INFO) << "Using optical flow: " << (use_optflow_ ? "true" : "false");
nvof_ = cv::cuda::NvidiaOpticalFlow_1_0::create(size.width, size.height,
cv::cuda::NvidiaOpticalFlow_1_0::NV_OF_PERF_LEVEL_SLOW,
true, false, false, 0);
*/
#endif
calib_ = ftl::create<Calibrate>(host_, "calibration", size, stream_);
......@@ -180,6 +181,9 @@ bool StereoVideoSource::retrieve() {
lsrc_->get(left, right, calib_, stream2_);
#ifdef HAVE_OPTFLOW
/*
// see comments in https://gitlab.utu.fi/nicolas.pope/ftl/issues/155
if (use_optflow_)
{
auto &left_gray = frame.setChannel<cv::cuda::GpuMat>(kChanLeftGray);
......@@ -197,6 +201,7 @@ bool StereoVideoSource::retrieve() {
cv::cuda::resize(optflow_, optflow, left.size(), 0.0, 0.0, cv::INTER_NEAREST, stream2_);
}
}
*/
#endif
stream2_.waitForCompletion();
......
......@@ -51,8 +51,11 @@ class StereoVideoSource : public detail::Source {
cv::Mat mask_l_;
#ifdef HAVE_OPTFLOW
/*
// see comments in https://gitlab.utu.fi/nicolas.pope/ftl/issues/155
cv::Ptr<cv::cuda::NvidiaOpticalFlow_1_0> nvof_;
cv::cuda::GpuMat optflow_;
*/
#endif
void init(const std::string &);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment