47 magnitudeSumAbsolute = 0.;
48 magnitudeAverage = 0.;
49 magnitudeAverageAbsolute = 0.;
53 phaseSumAbsolute = 0.;
55 phaseAverageAbsolute = 0.;
58 centreOfGravity.assign(0.,0.,0.);
59 eigenValues.assign(0.,0.,0.);
60 eigenVectors[0].assign(0.,0.,0.);
61 eigenVectors[1].assign(0.,0.,0.);
62 eigenVectors[2].assign(0.,0.,0.);
63 orientedExtentsMin.assign(0.,0.,0.);
64 orientedExtentsMax.assign(0.,0.,0.);
66 planeIntersection.assign(0.,0.,0.);
67 planeIntersectionOk =
false;
88 const std::string &magnitudeFloatMemberName,
89 const std::string &phaseFloatMemberName)
92 const double numPointsDbl =
static_cast<double>(numPoints);
95 magnitudeAverage = magnitudeSum / numPointsDbl;
96 magnitudeAverageAbsolute = magnitudeSumAbsolute / numPointsDbl;
99 phaseAverage = phaseSum / numPointsDbl;
100 phaseAverageAbsolute = phaseSumAbsolute / numPointsDbl;
104 pcl::copyPointCloud(inputPointCloud, indices, clusterCloud);
108 stats = PCLSupportTools::getStatistics(clusterCloud, magnitudeFloatMemberName,
true);
109 magnitudeMedian = stats.
median;
110 stats = PCLSupportTools::getStatistics(clusterCloud, phaseFloatMemberName,
true);
111 phaseMedian = stats.
median;
114 if (clusterCloud.points.size() >=3 ){
117 pcl::PCA<MLPointCloudXYZINormal::PointType> PCAFilter;
119 const Eigen::Vector4f meanTmp = PCAFilter.getMean();
120 const Eigen::Vector3f eigenValuesTmp = PCAFilter.getEigenValues();
121 const Eigen::Vector3f eigenVector0Tmp = PCAFilter.getEigenVectors().col(0);
122 const Eigen::Vector3f eigenVector1Tmp = PCAFilter.getEigenVectors().col(1);
123 const Eigen::Vector3f eigenVector2Tmp = PCAFilter.getEigenVectors().col(2);
125 centreOfGravity.assign( meanTmp[0], meanTmp[1], meanTmp[2] );
126 eigenValues.assign( eigenValuesTmp[0], eigenValuesTmp[1], eigenValuesTmp[2] );
127 eigenVectors[0].assign( eigenVector0Tmp[0], eigenVector0Tmp[1], eigenVector0Tmp[2] );
128 eigenVectors[1].assign( eigenVector1Tmp[0], eigenVector1Tmp[1], eigenVector1Tmp[2] );
129 eigenVectors[2].assign( eigenVector2Tmp[0], eigenVector2Tmp[1], eigenVector2Tmp[2] );
133 PCAFilter.project(clusterCloud, tmpCloud);
134 pcl::PointXYZINormal minPoint, maxPoint;
135 pcl::getMinMax3D(tmpCloud, minPoint, maxPoint);
138 orientedExtentsMin[0] = minPoint.x;
139 orientedExtentsMin[1] = minPoint.y;
140 orientedExtentsMin[2] = minPoint.z;
141 orientedExtentsMax[0] = maxPoint.x;
142 orientedExtentsMax[1] = maxPoint.y;
143 orientedExtentsMax[2] = maxPoint.z;
147 Plane plane(planeNormal, planePoint);
148 Line line(centreOfGravity, centreOfGravity+eigenVectors[0]);
149 planeIntersectionOk = plane.
intersect(line, planeIntersection);