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

Mess with confidence channel

parent 61146e59
No related branches found
No related tags found
1 merge request!122Implements #183 depth ray correspondences
This commit is part of merge request !122. Comments created here will be created in the context of that merge request.
...@@ -23,7 +23,7 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) { ...@@ -23,7 +23,7 @@ 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); fill_depth_ = value("fill_depth", false);
on("fill_depth", [this](const ftl::config::Event &e) { on("fill_depth", [this](const ftl::config::Event &e) {
fill_depth_ = value("fill_depth", true); fill_depth_ = value("fill_depth", true);
......
...@@ -160,21 +160,21 @@ __global__ void correspondence_energy_vector_kernel( ...@@ -160,21 +160,21 @@ __global__ void correspondence_energy_vector_kernel(
const float depth2 = d2.tex2D((int)screen.x, (int)screen.y); const float depth2 = d2.tex2D((int)screen.x, (int)screen.y);
// Determine degree of correspondence // Determine degree of correspondence
float cost = 1.0f - ftl::cuda::weighting(fabs(depth2 - camPos.z), params.spatial_smooth); float cost = ftl::cuda::weighting(fabs(depth2 - camPos.z), params.spatial_smooth);
// Point is too far away to even count // Point is too far away to even count
if (cost == 1.0f) continue; //if (cost == 1.0f) continue;
const uchar4 colour2 = c2.tex2D((int)screen.x, (int)screen.y); const uchar4 colour2 = c2.tex2D((int)screen.x, (int)screen.y);
// Mix ratio of colour and distance costs // Mix ratio of colour and distance costs
const float ccost = 1.0f - ftl::cuda::colourWeighting(colour1, colour2, params.colour_smooth); const float ccost = ftl::cuda::colourWeighting(colour1, colour2, params.colour_smooth);
if ((params.flags & ftl::cuda::kILWFlag_SkipBadColour) && ccost == 1.0f) continue; //if ((params.flags & ftl::cuda::kILWFlag_SkipBadColour) && ccost == 1.0f) continue;
// Cost eq 1: summed contributions // Cost eq 1: summed contributions
cost = params.cost_ratio * (ccost) + (1.0f - params.cost_ratio) * cost; cost = 1.0f - (params.cost_ratio * (ccost) + (1.0f - params.cost_ratio) * cost);
// Cost eq 2: Multiplied // Cost eq 2: Multiplied
//cost = ccost * cost * cost * cost; //cost = 1.0f - (ccost * ccost * cost);
++count; ++count;
avgcost += (params.flags & ftl::cuda::kILWFlag_ColourConfidenceOnly) ? ccost : cost; avgcost += (params.flags & ftl::cuda::kILWFlag_ColourConfidenceOnly) ? ccost : cost;
......
...@@ -363,10 +363,10 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda ...@@ -363,10 +363,10 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda
cv::cuda::swap(temp_.get<GpuMat>(Channel::Colour), out.create<GpuMat>(Channel::Normals)); cv::cuda::swap(temp_.get<GpuMat>(Channel::Colour), out.create<GpuMat>(Channel::Normals));
out.resetTexture(Channel::Normals); out.resetTexture(Channel::Normals);
} }
else if (chan == Channel::Contribution) //else if (chan == Channel::Contribution)
{ //{
cv::cuda::swap(temp_.get<GpuMat>(Channel::Contribution), out.create<GpuMat>(Channel::Contribution)); // cv::cuda::swap(temp_.get<GpuMat>(Channel::Contribution), out.create<GpuMat>(Channel::Contribution));
} //}
else if (chan == Channel::Right) else if (chan == Channel::Right)
{ {
Eigen::Affine3f transform(Eigen::Translation3f(camera.baseline,0.0f,0.0f)); Eigen::Affine3f transform(Eigen::Translation3f(camera.baseline,0.0f,0.0f));
......
...@@ -105,6 +105,7 @@ inline bool isFloatChannel(ftl::rgbd::Channel chan) { ...@@ -105,6 +105,7 @@ inline bool isFloatChannel(ftl::rgbd::Channel chan) {
switch (chan) { switch (chan) {
case Channel::Depth : case Channel::Depth :
//case Channel::Normals : //case Channel::Normals :
case Channel::Confidence:
case Channel::Energy : return true; case Channel::Energy : return true;
default : return false; default : return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment