42#include <pcl/ml/kmeans.h>
51template <
typename Po
intT>
55template <
typename Po
intT>
59template <
typename Po
intT>
63 if (!initCompute() || (input_ != 0 && input_->points.empty()) ||
64 (indices_ != 0 && indices_->empty())) {
70 std::vector<pcl::PCLPointField> fields;
73 if (strcmp(cluster_field_name_.c_str(),
"") == 0) {
83 if (x_index == -1 && y_index == -1 && z_index == -1) {
84 PCL_ERROR(
"Failed to find match for field 'x y z'\n");
88 PCL_INFO(
"Use X Y Z as input data\n");
101 std::cout <<
"x index: " << x_index << std::endl;
104 memcpy(&x, &(*input_)[0] + fields[x_index].offset,
sizeof(
float));
106 std::cout <<
"xxx: " << x << std::endl;
121 if (user_index == -1) {
122 PCL_ERROR(
"Failed to find match for field '%s'\n", cluster_field_name_.c_str());
163#define PCL_INSTANTIATE_Kmeans(T) template class PCL_EXPORTS pcl::Kmeans<T>;
~Kmeans()
This destructor destroys.
Kmeans(unsigned int num_points, unsigned int num_dimensions)
Empty constructor.
PointCloud represents the base class in PCL for storing collections of 3D points.
int getFieldIndex(const pcl::PointCloud< PointT > &, const std::string &field_name, std::vector< pcl::PCLPointField > &fields)