Skip to content

Commit ac66099

Browse files
committed
Make cov zero before accumulating in it
1 parent 3452aac commit ac66099

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

common/include/pcl/common/impl/centroid.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
199199
// If the data is dense, we don't need to check for NaN
200200
if (cloud.is_dense)
201201
{
202+
covariance_matrix.setZero ();
202203
point_count = static_cast<unsigned> (cloud.size ());
203204
// For each point in the cloud
204205
for (const auto& point: cloud)
@@ -288,6 +289,7 @@ computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
288289
// If the data is dense, we don't need to check for NaN
289290
if (cloud.is_dense)
290291
{
292+
covariance_matrix.setZero ();
291293
point_count = indices.size ();
292294
// For each point in the cloud
293295
for (const auto& idx: indices)

0 commit comments

Comments
 (0)