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