Skip to content

Commit

Permalink
Do not recompute the same expression twice and fixes potential divisi…
Browse files Browse the repository at this point in the history
…on by zero
  • Loading branch information
taketwo committed Jun 21, 2017
1 parent 31c874a commit 3d9b59b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Core/src/Utils/RGBDOdometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,14 @@ void RGBDOdometry::getIncrementalTransformation(Eigen::Vector3f & trans,
}

float sigmaVal = std::sqrt((float)sigma / rgbSize == 0 ? 1 : rgbSize);
float rgbError = std::sqrt(sigma) / (rgbSize == 0 ? 1 : rgbSize);

if(rgbOnly && sqrt(sigma) / rgbSize > lastRGBError)
if(rgbOnly && rgbError > lastRGBError)
{
break;
}

lastRGBError = sqrt(sigma) / rgbSize;
lastRGBError = rgbError;
lastRGBCount = rgbSize;

if(rgbOnly)
Expand Down

0 comments on commit 3d9b59b

Please sign in to comment.