-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Modularize euclidean clustering #4268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
d54bb58
1b7a763
a985a57
242b8f5
0353506
d4f96b1
c7d6838
4282d2f
fbf3b4b
20ac71c
795b545
bd3bc6b
08b5155
7d4f504
a2bcb28
95204a3
0128a1f
228fae4
b6283ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -47,6 +47,21 @@ | |||||||||||||
namespace pcl | ||||||||||||||
{ | ||||||||||||||
|
||||||||||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||||||||||||
/** \brief Decompose a region of space into clusters based on the Euclidean distance between points | ||||||||||||||
* \param it cloud iterator for iterating over the points | ||||||||||||||
* \param cloud the point cloud message | ||||||||||||||
* \param additional_filter_criteria functor which is used as an additonal criteria that all points being added to the cluster must satisfy | ||||||||||||||
* \param tree the spatial locator (e.g., kd-tree) used for nearest neighbors searching | ||||||||||||||
* \note the tree has to be created as a spatial locator on \a cloud and \a indices | ||||||||||||||
* \param tolerance the spatial cluster tolerance as a measure in L2 Euclidean space | ||||||||||||||
* \param clusters the resultant clusters containing point indices (as a vector of PointIndices) | ||||||||||||||
* \param min_pts_per_cluster minimum number of points that a cluster may contain (default: 1) | ||||||||||||||
* \param max_pts_per_cluster maximum number of points that a cluster may contain (default: max int) | ||||||||||||||
* \warning It is assumed that that the tree built on the same indices and cloud as passed here, | ||||||||||||||
* if that is not the case then things can go very wrong. For speed reasons, we only check the sizes and not the content | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please reword to be in a passive voice. This example is not quite right but should point you in the correct direction:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spelling error |
||||||||||||||
* \ingroup segmentation | ||||||||||||||
*/ | ||||||||||||||
template <typename PointT, typename FunctorT> void | ||||||||||||||
extractEuclideanClusters( | ||||||||||||||
ConstCloudIterator<PointT> &it, const PointCloud<PointT> &cloud, FunctorT additional_filter_criteria, | ||||||||||||||
SergioRAgostinho marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not liking this pattern where you pass the cloud iterator as an argument, but still pass the whole point cloud as well to the function. Please change to the following. extractEuclideanClusters(const PointCloud<PointT> &cloud, const Indices &indices, [...]); Overloads which don't have indices in their function signature, should supply empty indices to this method. You call the appropriate constructor for CloudIterator after checking if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the Let's kill the idea of using the cloudIterator in public interface and hide it. It's still useful for removing common code, but beyond that, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's a problematic behavior chain in pipelines. If after filtering/previous segmentation my indices became empty, now this clustering would run on the entire point cloud 😱 |
||||||||||||||
|
@@ -109,6 +124,20 @@ namespace pcl | |||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||||||||||||
/** \brief Decompose a region of space into clusters based on the Euclidean distance between points | ||||||||||||||
* \param cloud the point cloud message | ||||||||||||||
* \param additional_filter_criteria functor which is used as an additonal criteria that all points being added to the cluster must satisfy | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the constraints on the functor? Does Tighten the interface appropriately:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Pick it up form pcl/filters/include/pcl/filters/functor_filter.h Lines 16 to 21 in c262ec6
Slighlty off topic, whats the reason for using pcl::remove_cvref_t and then adding const and & ?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a brain-fart. The remove_cvref was meant for something else, but in refactoring from old version to the newer simplified checker implementation, it managed to slip through. |
||||||||||||||
* \param tree the spatial locator (e.g., kd-tree) used for nearest neighbors searching | ||||||||||||||
* \note the tree has to be created as a spatial locator on \a cloud and \a indices | ||||||||||||||
* \param tolerance the spatial cluster tolerance as a measure in L2 Euclidean space | ||||||||||||||
* \param clusters the resultant clusters containing point indices (as a vector of PointIndices) | ||||||||||||||
* \param min_pts_per_cluster minimum number of points that a cluster may contain (default: 1) | ||||||||||||||
* \param max_pts_per_cluster maximum number of points that a cluster may contain (default: max int) | ||||||||||||||
* \warning It is assumed that that the tree built on the same indices and cloud as passed here, | ||||||||||||||
* if that is not the case then things can go very wrong. For speed reasons, we only check the sizes and not the content | ||||||||||||||
* \ingroup segmentation | ||||||||||||||
*/ | ||||||||||||||
template <typename PointT, typename FunctorT> void | ||||||||||||||
extractEuclideanClusters ( | ||||||||||||||
const PointCloud<PointT> &cloud, | ||||||||||||||
|
@@ -120,6 +149,21 @@ namespace pcl | |||||||||||||
extractEuclideanClusters(it, cloud, additional_filter_criteria, tree, tolerance, clusters, min_pts_per_cluster, max_pts_per_cluster); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||||||||||||
/** \brief Decompose a region of space into clusters based on the Euclidean distance between points | ||||||||||||||
* \param cloud the point cloud message | ||||||||||||||
* \param indices a list of point indices to use from \a cloud | ||||||||||||||
* \param additional_filter_criteria functor which is used as an additonal criteria that all points being added to the cluster must satisfy | ||||||||||||||
* \param tree the spatial locator (e.g., kd-tree) used for nearest neighbors searching | ||||||||||||||
* \note the tree has to be created as a spatial locator on \a cloud and \a indices | ||||||||||||||
* \param tolerance the spatial cluster tolerance as a measure in L2 Euclidean space | ||||||||||||||
* \param clusters the resultant clusters containing point indices (as a vector of PointIndices) | ||||||||||||||
* \param min_pts_per_cluster minimum number of points that a cluster may contain (default: 1) | ||||||||||||||
* \param max_pts_per_cluster maximum number of points that a cluster may contain (default: max int) | ||||||||||||||
* \warning It is assumed that that the tree built on the same indices and cloud as passed here, | ||||||||||||||
* if that is not the case then things can go very wrong. For speed reasons, we only check the sizes and not the content | ||||||||||||||
* \ingroup segmentation | ||||||||||||||
*/ | ||||||||||||||
template <typename PointT, typename FunctorT> void | ||||||||||||||
extractEuclideanClusters ( | ||||||||||||||
const PointCloud<PointT> &cloud, const Indices &indices, | ||||||||||||||
|
@@ -202,6 +246,7 @@ namespace pcl | |||||||||||||
return; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
eps_angle = std::max(std::abs(eps_angle), M_PI); | ||||||||||||||
shrijitsingh99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
auto cos_eps_angle = std::cos(eps_angle); | ||||||||||||||
auto normal_deviation_filter = [&](index_t i, index_t j, const Indices& nn_indices) -> bool { | ||||||||||||||
double dot_p = normals[i].getNormalVector3fMap().dot(normals[nn_indices[j]].getNormalVector3fMap()); | ||||||||||||||
|
@@ -243,6 +288,7 @@ namespace pcl | |||||||||||||
if (indices.empty()) | ||||||||||||||
return; | ||||||||||||||
|
||||||||||||||
eps_angle = std::max(std::abs(eps_angle), M_PI); | ||||||||||||||
auto cos_eps_angle = std::cos(eps_angle); | ||||||||||||||
auto normal_deviation_filter = [&](index_t i, index_t j, Indices& nn_indices) -> bool { | ||||||||||||||
double dot_p = | ||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.