Skip to content
Snippets Groups Projects
Commit 8dc47d9b authored by Corvin-N's avatar Corvin-N
Browse files

Implement basic version of getClusterSize

parent d6027916
No related branches found
No related tags found
2 merge requests!68Add human tracking,!28Draft: Dev -> Main
...@@ -220,4 +220,22 @@ namespace armarx::navigation::human ...@@ -220,4 +220,22 @@ namespace armarx::navigation::human
trackedHuman->trackingId = detectedHuman->trackingId; trackedHuman->trackingId = detectedHuman->trackingId;
} }
float
HumanTracker::getClusterSize(armem::vision::LaserScannerFeature cluster)
{
float maxSize = 0;
for (auto it1 = cluster.points.begin(); it1 != cluster.points.end();)
{
auto& point1 = *it1;
for (auto it2 = it1 + 1; it2 != cluster.points.end();)
{
auto& point2 = *it2;
float xdiff = point2.x() - point1.x();
float ydiff = point2.y() - point1.y();
maxSize = std::max(maxSize, std::sqrt(xdiff * xdiff + ydiff * ydiff));
}
}
return maxSize;
}
} // namespace armarx::navigation::human } // namespace armarx::navigation::human
...@@ -167,6 +167,13 @@ namespace armarx::navigation::human ...@@ -167,6 +167,13 @@ namespace armarx::navigation::human
* @param detectedHuman the detected human * @param detectedHuman the detected human
*/ */
void associate(TrackedHuman* tracked, DetectedHuman* detected); void associate(TrackedHuman* tracked, DetectedHuman* detected);
/**
* @brief getClusterSize Returns the size of the given cluster. That is for now the maximum
* distance between two points.
* @param cluster The cluster whose size is measured
* @return the size
*/
float getClusterSize(armem::vision::LaserScannerFeature cluster);
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment