pcl::Kmeans Class Reference

K-means clustering. More...

`#include <pcl/ml/kmeans.h>`

## Public Types

using | PointId = unsigned int
using | ClusterId = unsigned int
using | SetPoints = std::set< PointId >
using | Point = std::vector< float >
using | ClustersToPoints = std::vector< SetPoints >
using | PointsToClusters = std::vector< ClusterId >
using | Centroids = std::vector< Point >

## Public Member Functions

| Kmeans (unsigned int num_points, unsigned int num_dimensions)
| Empty constructor. More...
| ~Kmeans ()
| This destructor destroys. More...
void | setClusterSize (unsigned int k)
| This method sets the k-means cluster size. More...
void | kMeans ()
void | setInputData (std::vector< Point > &data)
void | addDataPoint (Point &data_point)
void | initialClusterPoints ()
void | computeCentroids ()
float | distance (const Point &x, const Point &y)
Centroids | get_centroids ()

## Protected Attributes

unsigned int | num_points_
unsigned int | num_dimensions_
unsigned int | num_clusters_
| The number of clusters. More...
std::vector< Point > | data_
| The cluster centroids. More...
ClustersToPoints | clusters_to_points_
PointsToClusters | points_to_clusters_
Centroids | centroids_

## Detailed Description

K-means clustering.

Author
  Christian Potthast

Definition at line 60 of file kmeans.h.

## Member Typedef Documentation

## Centroids

using pcl::Kmeans::Centroids = std::vector<Point>

Definition at line 76 of file kmeans.h.

## ClusterId

using pcl::Kmeans::ClusterId = unsigned int

Definition at line 63 of file kmeans.h.

## ClustersToPoints

using pcl::Kmeans::ClustersToPoints = std::vector<SetPoints>

Definition at line 72 of file kmeans.h.

## Point

using pcl::Kmeans::Point = std::vector<float>

Definition at line 69 of file kmeans.h.

## PointId

using pcl::Kmeans::PointId = unsigned int

Definition at line 62 of file kmeans.h.

## PointsToClusters

using pcl::Kmeans::PointsToClusters = std::vector<ClusterId>

Definition at line 74 of file kmeans.h.

## SetPoints

using pcl::Kmeans::SetPoints = std::set<PointId>

Definition at line 67 of file kmeans.h.

## Constructor & Destructor Documentation

## Kmeans()

pcl::Kmeans::Kmeans | ( | unsigned int | num_points,
|  | unsigned int | num_dimensions
| ) |  |

Empty constructor.

Definition at line 51 of file kmeans.hpp.

## ~Kmeans()

pcl::Kmeans::~Kmeans | ( |  | ) |

This destructor destroys.

Definition at line 55 of file kmeans.hpp.

## Member Function Documentation

## addDataPoint()

void pcl::Kmeans::addDataPoint | ( | Point & | data_point | ) |

inline

Definition at line 121 of file kmeans.h.

Referenced by pcl::UnaryClassifier< PointT >::kmeansClustering().

## computeCentroids()

void pcl::Kmeans::computeCentroids | ( |  | ) |

## distance()

float pcl::Kmeans::distance | ( | const Point & | x,
|  | const Point & | y
| ) |  |

inline

Definition at line 138 of file kmeans.h.

## get_centroids()

Centroids pcl::Kmeans::get_centroids | ( |  | ) |

inline

Definition at line 152 of file kmeans.h.

Referenced by pcl::UnaryClassifier< PointT >::kmeansClustering().

## initialClusterPoints()

void pcl::Kmeans::initialClusterPoints | ( |  | ) |

## kMeans()

void pcl::Kmeans::kMeans | ( |  | ) |

Referenced by pcl::UnaryClassifier< PointT >::kmeansClustering().

## setClusterSize()

void pcl::Kmeans::setClusterSize | ( | unsigned int | k | ) |

inline

This method sets the k-means cluster size.

Parameters

  [in] | k | number of clusters

Definition at line 89 of file kmeans.h.

Referenced by pcl::UnaryClassifier< PointT >::kmeansClustering().

## setInputData()

void pcl::Kmeans::setInputData | ( | std::vector< Point > & | data | ) |

inline

Definition at line 112 of file kmeans.h.

## Member Data Documentation

## centroids_

Centroids pcl::Kmeans::centroids_

protected

Definition at line 184 of file kmeans.h.

## clusters_to_points_

ClustersToPoints pcl::Kmeans::clusters_to_points_

protected

Definition at line 182 of file kmeans.h.

## data_

std::vector<Point> pcl::Kmeans::data_

protected

The cluster centroids.

Definition at line 180 of file kmeans.h.

## num_clusters_

unsigned int pcl::Kmeans::num_clusters_

protected

The number of clusters.

Definition at line 170 of file kmeans.h.

## num_dimensions_

unsigned int pcl::Kmeans::num_dimensions_

protected

Definition at line 167 of file kmeans.h.

## num_points_

unsigned int pcl::Kmeans::num_points_

protected

Definition at line 166 of file kmeans.h.

## points_to_clusters_

PointsToClusters pcl::Kmeans::points_to_clusters_

protected

Definition at line 183 of file kmeans.h.

The documentation for this class was generated from the following files:

- pcl/ml/kmeans.h
- pcl/ml/impl/kmeans.hpp