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

Allow config of discon mask size

parent 5d30c114
No related branches found
No related tags found
1 merge request!116Implements #133 point alignment
......@@ -22,6 +22,7 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) {
params_.colour_smooth = value("colour_smooth", 50.0f);
params_.spatial_smooth = value("spatial_smooth", 0.04f);
params_.cost_ratio = value("cost_ratio", 0.75f);
discon_mask_ = value("discontinuity_mask",2);
on("ilw_align", [this](const ftl::config::Event &e) {
enabled_ = value("ilw_align", true);
......@@ -39,6 +40,10 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) {
motion_window_ = value("motion_window", 3);
});
on("discontinuity_mask", [this](const ftl::config::Event &e) {
discon_mask_ = value("discontinuity_mask", 2);
});
on("use_Lab", [this](const ftl::config::Event &e) {
use_lab_ = value("use_Lab", false);
});
......@@ -116,7 +121,7 @@ bool ILW::_phase0(ftl::rgbd::FrameSet &fs, cudaStream_t stream) {
auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size()));
auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>()); //.inverse());
ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, 2, stream);
ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, discon_mask_, stream);
// TODO: Create energy vector texture and clear it
// Create energy and clear it
......
......@@ -69,6 +69,7 @@ class ILW : public ftl::Configurable {
float motion_rate_;
int motion_window_;
bool use_lab_;
int discon_mask_;
};
}
......
......@@ -51,6 +51,7 @@ void ftl::cuda::point_cloud(ftl::cuda::TextureObject<float4> &output, ftl::cuda:
const dim3 blockSize(T_PER_BLOCK, T_PER_BLOCK);
switch (discon) {
case 4 : point_cloud_kernel<4><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break;
case 3 : point_cloud_kernel<3><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break;
case 2 : point_cloud_kernel<2><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break;
case 1 : point_cloud_kernel<1><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break;
......
......@@ -85,22 +85,6 @@ void Splatter::renderChannel(
continue;
}
// Needs to create points channel first?
if (!f.hasChannel(Channel::Points)) {
//LOG(INFO) << "Creating points... " << s->parameters().width;
auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size()));
auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>()); //.inverse());
ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, 0, stream);
//LOG(INFO) << "POINTS Added";
}
// Clip first?
if (clipping_) {
ftl::cuda::clipping(f.createTexture<float4>(Channel::Points), clip_, stream);
}
ftl::cuda::dibr_merge(
f.createTexture<float4>(Channel::Points),
temp_.getTexture<int>(Channel::Depth),
......@@ -262,6 +246,22 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda
auto &f = scene_->frames[i];
auto s = scene_->sources[i];
// Needs to create points channel first?
if (!f.hasChannel(Channel::Points)) {
//LOG(INFO) << "Creating points... " << s->parameters().width;
auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size()));
auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>()); //.inverse());
ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, 0, stream);
//LOG(INFO) << "POINTS Added";
}
// Clip first?
if (clipping_) {
ftl::cuda::clipping(f.createTexture<float4>(Channel::Points), clip_, stream);
}
if (!f.hasChannel(Channel::Normals)) {
auto &g = f.get<GpuMat>(Channel::Colour);
ftl::cuda::normals(f.createTexture<float4>(Channel::Normals, Format<float4>(g.cols, g.rows)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment