I have found the centroid and the eigenvectors of a cluster. How can I draw the vector from the centroid in pcl visualizer.
Eigen::Vector4f centroid;
Eigen::Matrix3f covariance_matrix;
// Extract the eigenvalues and eigenvectors
Eigen::Vector3f eigen_values;
Eigen::Matrix3f eigen_vectors;
pcl::compute3DCentroid(*cloud_filtered,cluster_indices[i],centroid);
// Compute the 3x3 covariance matrix
pcl::computeCovarianceMatrix (*cloud_filtered, centroid, covariance_matrix);
pcl::eigen33 (covariance_matrix, eigen_vectors, eigen_values);
_viewer->addLine<pcl::PointXYZRGB> (centroid, eigen_vectors, "line");
Aucun commentaire:
Enregistrer un commentaire