mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
ICP/intensity: Applying fix from #1111
This commit is contained in:
@@ -513,17 +513,29 @@ public:
|
|||||||
for (int i = 0; i < pointsCount; ++i)
|
for (int i = 0; i < pointsCount; ++i)
|
||||||
{
|
{
|
||||||
float minDistance = std::numeric_limits<float>::max();
|
float minDistance = std::numeric_limits<float>::max();
|
||||||
|
bool minDistFound = false;
|
||||||
for(int k=0; k<knn && k<filteredReferenceIntensity.rows(); ++k)
|
for(int k=0; k<knn && k<filteredReferenceIntensity.rows(); ++k)
|
||||||
{
|
{
|
||||||
float distIntensity = fabs(filteredReadingIntensity(0,i) - filteredReferenceIntensity(0, matches.ids.coeff(k, i)));
|
int matchesIdsCoeff = matches.ids.coeff(k, i);
|
||||||
|
if (matchesIdsCoeff!=-1)
|
||||||
|
{
|
||||||
|
float distIntensity = fabs(filteredReadingIntensity(0,i) - filteredReferenceIntensity(0, matchesIdsCoeff));
|
||||||
if(distIntensity < minDistance)
|
if(distIntensity < minDistance)
|
||||||
{
|
{
|
||||||
matchesOrderedByIntensity.ids.coeffRef(0, i) = matches.ids.coeff(k, i);
|
matchesOrderedByIntensity.ids.coeffRef(0, i) = matches.ids.coeff(k, i);
|
||||||
matchesOrderedByIntensity.dists.coeffRef(0, i) = matches.dists.coeff(k, i);
|
matchesOrderedByIntensity.dists.coeffRef(0, i) = matches.dists.coeff(k, i);
|
||||||
minDistance = distIntensity;
|
minDistance = distIntensity;
|
||||||
|
minDistFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!minDistFound)
|
||||||
|
{
|
||||||
|
matchesOrderedByIntensity.ids.coeffRef(0, i) = matches.ids.coeff(0, i);
|
||||||
|
matchesOrderedByIntensity.dists.coeffRef(0, i) = matches.dists.coeff(0, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
matches = matchesOrderedByIntensity;
|
matches = matchesOrderedByIntensity;
|
||||||
}
|
}
|
||||||
return matches;
|
return matches;
|
||||||
|
|||||||
Reference in New Issue
Block a user