@@ -22,6 +22,7 @@ namespace diffCheck::segmentation
2222 {
2323 cilantro::KNNNeighborhoodSpecification<int > neighborhood (knnNeighborhoodSize);
2424
25+ // FIXME: not clear why this is needed all the time
2526 cilantroPointCloud->estimateNormals (neighborhood);
2627
2728 cilantro::NormalsProximityEvaluator<float , 3 > similarityEvaluator (
@@ -33,38 +34,31 @@ namespace diffCheck::segmentation
3334 auto clusterToPointMap = segmenter.getClusterToPointIndicesMap ();
3435 int nSegments = segmenter.getNumberOfClusters ();
3536
36- // FIXME: painting color not working (see paint_uniform?)
3737 for (int indice = 0 ; indice<nSegments; indice++)
3838 {
3939 std::shared_ptr<geometry::DFPointCloud> segment = std::make_shared<geometry::DFPointCloud>();
40-
41- // random rgb color in format Eigen::Vector3d from 0 to 1
42- Eigen::Vector3d color = Eigen::Vector3d::Random ();
4340 for (auto pointIndice : clusterToPointMap[indice])
4441 {
4542 Eigen::Vector3d point = cilantroPointCloud->points .col (pointIndice).cast <double >();
4643 Eigen::Vector3d normal = cilantroPointCloud->normals .col (pointIndice).cast <double >();
4744 segment->Points .push_back (point);
4845 segment->Normals .push_back (normal);
49- if (colorClusters)
50- segment->Colors .push_back (color);
51- else
46+ if (cilantroPointCloud->hasColors ())
5247 {
53- if (cilantroPointCloud->colors .cols () > 0 )
54- {
55- Eigen::Vector3d color = cilantroPointCloud->colors .col (pointIndice).cast <double >();
56- segment->Colors .push_back (color);
57- }
48+ Eigen::Vector3d color = cilantroPointCloud->colors .col (pointIndice).cast <double >();
49+ segment->Colors .push_back (color);
5850 }
5951 }
52+ if (colorClusters)
53+ segment->ApplyColor (Eigen::Vector3d::Random ());
6054 segments.push_back (segment);
6155 }
6256 }
6357 else
6458 {
6559 cilantro::RadiusNeighborhoodSpecification<float > neighborhood (radiusNeighborhoodSize);
6660
67- cilantroPointCloud->estimateNormals (neighborhood);
61+ // cilantroPointCloud->estimateNormals(neighborhood);
6862
6963 cilantro::NormalsProximityEvaluator<float , 3 > similarityEvaluator (
7064 cilantroPointCloud->normals ,
@@ -76,27 +70,15 @@ namespace diffCheck::segmentation
7670 auto clusterToPointMap = segmenter.getClusterToPointIndicesMap ();
7771 int nSegments = segmenter.getNumberOfClusters ();
7872
79- // FIXME: painting color not working (see paint_uniform?)
8073 for (int indice = 0 ; indice<nSegments; indice++)
8174 {
8275 std::shared_ptr<geometry::DFPointCloud> segment = std::make_shared<geometry::DFPointCloud>();
83- Eigen::Vector3d color = Eigen::Vector3d::Random ();
8476 for (auto pointIndice : clusterToPointMap[indice])
8577 {
8678 Eigen::Vector3d point = cilantroPointCloud->points .col (pointIndice).cast <double >();
8779 Eigen::Vector3d normal = cilantroPointCloud->normals .col (pointIndice).cast <double >();
8880 segment->Points .push_back (point);
8981 segment->Normals .push_back (normal);
90- if (colorClusters)
91- segment->Colors .push_back (color);
92- else
93- {
94- if (cilantroPointCloud->colors .cols () > 0 )
95- {
96- Eigen::Vector3d color = cilantroPointCloud->colors .col (pointIndice).cast <double >();
97- segment->Colors .push_back (color);
98- }
99- }
10082 }
10183 segments.push_back (segment);
10284 }
0 commit comments