Skip to content

Commit

Permalink
disable dense solve if no overlapping frames found
Browse files Browse the repository at this point in the history
  • Loading branch information
angeladai committed Jan 22, 2017
1 parent d9b0f31 commit af903f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion FriedLiver/Source/Solver/CUDASolverBundling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ extern "C" void solveBundlingStub(SolverInput& input, SolverState& state, Solver

extern "C" int countHighResiduals(SolverInput& input, SolverState& state, SolverParameters& parameters, CUDATimer* timer);

extern "C" void BuildDenseSystem(const SolverInput& input, SolverState& state, SolverParameters& parameters, CUDATimer* timer);
extern "C" void convertLiePosesToMatricesCU(const float3* d_rot, const float3* d_trans, unsigned int numTransforms, float4x4* d_transforms, float4x4* d_transformInvs);

extern "C" void collectHighResiduals(SolverInput& input, SolverState& state, SolverStateAnalysis& analysis, SolverParameters& parameters, CUDATimer* timer);
Expand Down
8 changes: 4 additions & 4 deletions FriedLiver/Source/Solver/SolverBundling.cu
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ __global__ void BuildDenseSystem_Kernel(SolverInput input, SolverState state, So
} // valid image pixel
}

extern "C"
void BuildDenseSystem(const SolverInput& input, SolverState& state, SolverParameters& parameters, CUDATimer* timer)
bool BuildDenseSystem(const SolverInput& input, SolverState& state, SolverParameters& parameters, CUDATimer* timer)
{
const unsigned int N = input.numberOfImages;
const int sizeJtr = 6 * N;
Expand Down Expand Up @@ -373,7 +372,7 @@ void BuildDenseSystem(const SolverInput& input, SolverState& state, SolverParame
cutilSafeCall(cudaMemcpy(&numOverlapImagePairs, state.d_numDenseOverlappingImages, sizeof(int), cudaMemcpyDeviceToHost));
if (numOverlapImagePairs == 0) {
printf("warning: no overlapping images for dense solve\n");
return;
return false;
}
const int reductionGlobal = (input.denseDepthWidth*input.denseDepthHeight + THREADS_PER_BLOCK_DENSE_DEPTH - 1) / THREADS_PER_BLOCK_DENSE_DEPTH;
dim3 grid(numOverlapImagePairs, reductionGlobal);
Expand Down Expand Up @@ -442,6 +441,7 @@ void BuildDenseSystem(const SolverInput& input, SolverState& state, SolverParame
cutilCheckMsg(__FUNCTION__);
#endif
if (timer) timer->endEvent();
return true;
}

//todo more efficient?? (there are multiple per image-image...)
Expand Down Expand Up @@ -1136,7 +1136,7 @@ extern "C" void solveBundlingStub(SolverInput& input, SolverState& state, Solver
#ifdef USE_LIE_SPACE
convertLiePosesToMatricesCU(state.d_xRot, state.d_xTrans, input.numberOfImages, state.d_xTransforms, state.d_xTransformInverses);
#endif
if (parameters.useDense) BuildDenseSystem(input, state, parameters, timer);
if (parameters.useDense) parameters.useDense = BuildDenseSystem(input, state, parameters, timer); //don't solve dense if no overlapping frames found
Initialization(input, state, parameters, timer);

if (parameters.weightSparse > 0.0f) {
Expand Down

0 comments on commit af903f3

Please sign in to comment.