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

Add cost ratio

parent cf8da40e
No related branches found
No related tags found
2 merge requests!116Implements #133 point alignment,!114Ongoing #133 improvements
Pipeline #14606 passed
This commit is part of merge request !114. Comments created here will be created in the context of that merge request.
......@@ -64,16 +64,19 @@ __global__ void correspondence_energy_vector_kernel(
const uchar4 colour2 = c2.tex2D(screen2.x+u, screen2.y+v);
if (world2.x == MINF) continue;
++count;
// Determine degree of correspondence
float cost = 1.0f - ftl::cuda::spatialWeighting(world1, world2, 0.04f);
cost *= 1.0f - ftl::cuda::colourWeighting(colour1, colour2, 50.0f);
float cost = 1.0f - ftl::cuda::spatialWeighting(world1, world2, 0.04f);
// Point is too far away to even count
if (cost == 1.0f) continue;
// Mix ratio of colour and distance costs
cost = 0.75f * (1.0f - ftl::cuda::colourWeighting(colour1, colour2, 50.0f)) + 0.25 * cost;
//cost /= 2.0f;
++count;
avgcost += cost;
if (cost < bestcost) {
bestpoint = world2;
avgcost += cost;
bestcost = cost;
}
}
......@@ -91,9 +94,11 @@ __global__ void correspondence_energy_vector_kernel(
(bestpoint.z - world1.z),
mincost);
//eout(x,y) = max(eout(x,y), length(bestpoint-world1) * 10.0f);
//eout(x,y) = max(eout(x,y), (length(bestpoint-world1) / 0.04f) * 7.0f);
//eout(x,y) = max(eout(x,y), (1.0f - mincost) * 7.0f);
eout(x,y) = max(eout(x, y), confidence * 7.0f);
//eout(x,y) = max(eout(x, y), (1.0f - mincost) * confidence * (length(bestpoint-world1) / 0.04f) * 12.0f);
//eout(x,y) = max(eout(x, y), (1.0f - mincost) * confidence * 12.0f);
eout(x,y) = max(eout(x, y), confidence * 12.0f);
} else if (mincost >= 1.0f && lane == 0) {
//vout(x,y) = make_float4(0.0f);
//eout(x,y) = 0.0f;
......
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