Skip to content
Snippets Groups Projects
Commit 61146e59 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Allow disable of filling

parent 39d53443
Branches
Tags
1 merge request!122Implements #183 depth ray correspondences
...@@ -23,6 +23,11 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) { ...@@ -23,6 +23,11 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) {
params_.spatial_smooth = value("spatial_smooth", 0.04f); params_.spatial_smooth = value("spatial_smooth", 0.04f);
params_.cost_ratio = value("cost_ratio", 0.2f); params_.cost_ratio = value("cost_ratio", 0.2f);
discon_mask_ = value("discontinuity_mask",2); discon_mask_ = value("discontinuity_mask",2);
fill_depth_ = value("fill_depth", true);
on("fill_depth", [this](const ftl::config::Event &e) {
fill_depth_ = value("fill_depth", true);
});
on("ilw_align", [this](const ftl::config::Event &e) { on("ilw_align", [this](const ftl::config::Event &e) {
enabled_ = value("ilw_align", true); enabled_ = value("ilw_align", true);
...@@ -160,6 +165,20 @@ bool ILW::_phase0(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { ...@@ -160,6 +165,20 @@ bool ILW::_phase0(ftl::rgbd::FrameSet &fs, cudaStream_t stream) {
f.createTexture<int>(Channel::Mask, Format<int>(f.get<GpuMat>(Channel::Colour).size())); f.createTexture<int>(Channel::Mask, Format<int>(f.get<GpuMat>(Channel::Colour).size()));
f.createTexture<uchar4>(Channel::Colour); f.createTexture<uchar4>(Channel::Colour);
f.createTexture<float>(Channel::Depth); f.createTexture<float>(Channel::Depth);
}
return true;
}
bool ILW::_phase1(ftl::rgbd::FrameSet &fs, int win, cudaStream_t stream) {
// Run correspondence kernel to create an energy vector
cv::cuda::Stream cvstream = cv::cuda::StreamAccessor::wrapStream(stream);
// First do any preprocessing
if (fill_depth_) {
for (size_t i=0; i<fs.frames.size(); ++i) {
auto &f = fs.frames[i];
auto s = fs.sources[i];
ftl::cuda::preprocess_depth( ftl::cuda::preprocess_depth(
f.getTexture<float>(Channel::Depth), f.getTexture<float>(Channel::Depth),
...@@ -174,14 +193,8 @@ bool ILW::_phase0(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { ...@@ -174,14 +193,8 @@ bool ILW::_phase0(ftl::rgbd::FrameSet &fs, cudaStream_t stream) {
//cv::cuda::swap(f.get<GpuMat>(Channel::Depth),f.get<GpuMat>(Channel::Depth2)); //cv::cuda::swap(f.get<GpuMat>(Channel::Depth),f.get<GpuMat>(Channel::Depth2));
f.swapChannels(Channel::Depth, Channel::Depth2); f.swapChannels(Channel::Depth, Channel::Depth2);
} }
return true;
} }
bool ILW::_phase1(ftl::rgbd::FrameSet &fs, int win, cudaStream_t stream) {
// Run correspondence kernel to create an energy vector
cv::cuda::Stream cvstream = cv::cuda::StreamAccessor::wrapStream(stream);
// For each camera combination // For each camera combination
for (size_t i=0; i<fs.frames.size(); ++i) { for (size_t i=0; i<fs.frames.size(); ++i) {
auto &f1 = fs.frames[i]; auto &f1 = fs.frames[i];
......
...@@ -70,6 +70,7 @@ class ILW : public ftl::Configurable { ...@@ -70,6 +70,7 @@ class ILW : public ftl::Configurable {
int motion_window_; int motion_window_;
bool use_lab_; bool use_lab_;
int discon_mask_; int discon_mask_;
bool fill_depth_;
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment