diff --git a/applications/reconstruct/src/ilw/ilw.cpp b/applications/reconstruct/src/ilw/ilw.cpp index 3b566df689aaae2cb2952a8c303aefd99751b7a1..a26fced0a49273dc50069d873885d47b9a5c732c 100644 --- a/applications/reconstruct/src/ilw/ilw.cpp +++ b/applications/reconstruct/src/ilw/ilw.cpp @@ -81,6 +81,9 @@ bool ILW::_phase1(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { // For each camera combination for (size_t i=0; i<fs.frames.size(); ++i) { + Eigen::Vector4d d1(0.0, 0.0, 1.0, 0.0); + d1 = fs.sources[i]->getPose() * d1; + for (size_t j=0; j<fs.frames.size(); ++j) { if (i == j) continue; @@ -91,6 +94,12 @@ bool ILW::_phase1(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { //auto s1 = fs.frames[i]; auto s2 = fs.sources[j]; + // Are cameras facing similar enough direction? + Eigen::Vector4d d2(0.0, 0.0, 1.0, 0.0); + d2 = fs.sources[j]->getPose() * d2; + // No, so skip this combination + if (d1.dot(d2) <= 0.0) continue; + auto pose = MatrixConversion::toCUDA(s2->getPose().cast<float>().inverse()); try { diff --git a/applications/reconstruct/src/ilw/ilw.cu b/applications/reconstruct/src/ilw/ilw.cu index 6acc5c6778146a6b7a8691113b8d1b714774ebd0..73a8e2bdff0b55f1213026a4f35d15494305a00a 100644 --- a/applications/reconstruct/src/ilw/ilw.cu +++ b/applications/reconstruct/src/ilw/ilw.cu @@ -57,8 +57,8 @@ __global__ void correspondence_energy_vector_kernel( // 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); - cost /= 2.0f; + cost *= 1.0f - ftl::cuda::colourWeighting(colour1, colour2, 50.0f); + //cost /= 2.0f; if (cost < bestcost) { bestpoint = world2; @@ -77,8 +77,10 @@ __global__ void correspondence_energy_vector_kernel( (bestpoint.x - world1.x), (bestpoint.y - world1.y), (bestpoint.z - world1.z), - mincost); - eout(x,y) = max(eout(x,y), (1.0f - mincost) * 7.0f); //confidence * 5.0f; + mincost); + + eout(x,y) = max(eout(x,y), length(bestpoint-world1) * 10.0f); + //eout(x,y) = max(eout(x,y), (1.0f - mincost) * 7.0f); //confidence * 5.0f; // FIXME: This needs to be summed across all frames //eout(x,y) = max(eout(x, y), confidence * 7.0f);