diff --git a/applications/reconstruct/src/ilw/ilw.cu b/applications/reconstruct/src/ilw/ilw.cu index c8fceaca593775e80b032072483a068bd73bb3d8..65fa54763bbb6e2b279eb280b9ae883f31e1a003 100644 --- a/applications/reconstruct/src/ilw/ilw.cu +++ b/applications/reconstruct/src/ilw/ilw.cu @@ -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;