Skip to content

Commit

Permalink
Merge branch 'likelihood_experiment' of https://github.com/borongyuan…
Browse files Browse the repository at this point in the history
…/rtabmap into borongyuan-likelihood_experiment
  • Loading branch information
matlabbe committed May 19, 2024
2 parents 256dcbd + f3cfa78 commit c034a96
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions corelib/src/Rtabmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5275,15 +5275,14 @@ void Rtabmap::adjustLikelihood(std::map<int, float> & likelihood) const


//Adjust likelihood with mean and standard deviation (see Angeli phd)
float epsilon = 0.0001;
float max = 0.0f;
int maxId = 0;
for(std::map<int, float>::iterator iter=++likelihood.begin(); iter!= likelihood.end(); ++iter)
{
float value = iter->second;
if(value > mean+stdDev && mean)
if(value > mean+stdDev && stdDev)
{
iter->second = (value-(stdDev-epsilon))/mean;
iter->second = (value-mean)/stdDev;
if(value > max)
{
max = value;
Expand All @@ -5305,9 +5304,9 @@ void Rtabmap::adjustLikelihood(std::map<int, float> & likelihood) const
}
}

if(stdDev > epsilon && max)
if(max > mean)
{
likelihood.begin()->second = mean/stdDev + 1.0f;
likelihood.begin()->second = stdDev/(max-mean) + 1.0f;
}
else
{
Expand Down

0 comments on commit c034a96

Please sign in to comment.