40 #ifndef PCL_KMEANS_HPP_ 41 #define PCL_KMEANS_HPP_ 43 #include <pcl/ml/kmeans.h> 52 template <
typename Po
intT>
54 : cluster_field_name_ (
"")
59 template <
typename Po
intT>
65 template <
typename Po
intT>
void 70 template <
typename Po
intT>
void 73 if (!initCompute () ||
74 (input_ != 0 && input_->points.empty ()) ||
75 (indices_ != 0 && indices_->empty ()))
82 std::vector<pcl::PCLPointField> fields;
86 if (strcmp (cluster_field_name_.c_str (),
"") == 0)
97 if (x_index == -1 && y_index == -1 && z_index == -1)
99 PCL_ERROR (
"Failed to find match for field 'x y z'\n" );
103 PCL_INFO (
"Use X Y Z as input data\n");
116 std::cout <<
"x index: " << x_index << std::endl;
119 memcpy (&x, &input_->points[0] + fields[x_index].offset,
sizeof(
float));
121 std::cout <<
"xxx: " << x << std::endl;
140 if (user_index == -1)
142 PCL_ERROR (
"Failed to find match for field '%s'\n", cluster_field_name_.c_str ());
192 #define PCL_INSTANTIATE_Kmeans(T) template class PCL_EXPORTS pcl::Kmeans<T>; 194 #endif // PCL_KMEANS_HPP_ int getFieldIndex(const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
Get the index of a specified field (i.e., dimension/channel)
Kmeans(unsigned int num_points, unsigned int num_dimensions)
Empty constructor.
~Kmeans()
This destructor destroys.
PointCloud represents the base class in PCL for storing collections of 3D points.