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

Allow disable of filling

parent 39d53443
No related branches found
No related tags found
1 merge request!122Implements #183 depth ray correspondences
......@@ -23,8 +23,13 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) {
params_.spatial_smooth = value("spatial_smooth", 0.04f);
params_.cost_ratio = value("cost_ratio", 0.2f);
discon_mask_ = value("discontinuity_mask",2);
fill_depth_ = value("fill_depth", true);
on("ilw_align", [this](const ftl::config::Event &e) {
on("fill_depth", [this](const ftl::config::Event &e) {
fill_depth_ = value("fill_depth", true);
});
on("ilw_align", [this](const ftl::config::Event &e) {
enabled_ = value("ilw_align", true);
});
......@@ -160,19 +165,6 @@ 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<uchar4>(Channel::Colour);
f.createTexture<float>(Channel::Depth);
ftl::cuda::preprocess_depth(
f.getTexture<float>(Channel::Depth),
f.getTexture<float>(Channel::Depth2),
f.getTexture<uchar4>(Channel::Colour),
f.getTexture<int>(Channel::Mask),
s->parameters(),
params_,
stream
);
//cv::cuda::swap(f.get<GpuMat>(Channel::Depth),f.get<GpuMat>(Channel::Depth2));
f.swapChannels(Channel::Depth, Channel::Depth2);
}
return true;
......@@ -182,6 +174,27 @@ 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(
f.getTexture<float>(Channel::Depth),
f.getTexture<float>(Channel::Depth2),
f.getTexture<uchar4>(Channel::Colour),
f.getTexture<int>(Channel::Mask),
s->parameters(),
params_,
stream
);
//cv::cuda::swap(f.get<GpuMat>(Channel::Depth),f.get<GpuMat>(Channel::Depth2));
f.swapChannels(Channel::Depth, Channel::Depth2);
}
}
// For each camera combination
for (size_t i=0; i<fs.frames.size(); ++i) {
auto &f1 = fs.frames[i];
......
......@@ -70,6 +70,7 @@ class ILW : public ftl::Configurable {
int motion_window_;
bool use_lab_;
int discon_mask_;
bool fill_depth_;
};
}
......
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