42 #include <pcl/ml/kmeans.h>
50 template <
typename Po
intT>
54 template <
typename Po
intT>
58 template <
typename Po
intT>
63 template <
typename Po
intT>
67 if (!initCompute() || (input_ != 0 && input_->points.empty()) ||
68 (indices_ != 0 && indices_->empty())) {
74 std::vector<pcl::PCLPointField> fields;
78 if (strcmp(cluster_field_name_.c_str(),
"") == 0) {
82 x_index = pcl::getFieldIndex<PointT>(
"x", fields);
84 y_index = pcl::getFieldIndex<PointT>(
"y", fields);
86 z_index = pcl::getFieldIndex<PointT>(
"z", fields);
88 if (x_index == -1 && y_index == -1 && z_index == -1) {
89 PCL_ERROR(
"Failed to find match for field 'x y z'\n");
93 PCL_INFO(
"Use X Y Z as input data\n");
106 std::cout <<
"x index: " << x_index << std::endl;
109 memcpy(&x, &input_->points[0] + fields[x_index].offset,
sizeof(
float));
111 std::cout <<
"xxx: " << x << std::endl;
124 user_index = pcl::getFieldIndex<PointT>(cluster_field_name_.c_str(), fields);
126 if (user_index == -1) {
127 PCL_ERROR(
"Failed to find match for field '%s'\n", cluster_field_name_.c_str());
167 #define PCL_INSTANTIATE_Kmeans(T) template class PCL_EXPORTS pcl::Kmeans<T>;