Public Types | Public Member Functions | Protected Attributes
cob_3d_features::KNNClassifier< PointT > Class Template Reference

k-nearest-neighbor classifier More...

#include <knn_classifier.h>

List of all members.

Public Types

typedef pcl::KdTree< PointTKdTree
typedef boost::shared_ptr< KdTreeKdTreePtr
typedef pcl::PointCloud< PointTPointCloud
typedef boost::shared_ptr
< const PointCloud
PointCloudConstPtr
typedef boost::shared_ptr
< PointCloud
PointCloudPtr

Public Member Functions

int classify (const PointT &p_q)
 classify a single point using the loaded training data
 KNNClassifier ()
int loadTrainingData (std::string &features_file_name, std::string &labels_file_name)
 load the training data and labels
int saveTrainingData (std::string &features_file_name, std::string &labels_file_name)
 save the loaded training data and labels
void setKNeighbors (int k)
 set the k neighbors to search for
void setTrainingFeatures (const PointCloudPtr &features, std::string &distanceMetric="L2")
 Set a point cloud containing the features samples.
void setTrainingLabels (const std::vector< int > &labels)
 setTrainingLabels
 ~KNNClassifier ()

Protected Attributes

std::string distanceMetric_
int k_
std::vector< int > labels_
int labels_max_
KdTreePtr tree_

Detailed Description

template<typename PointT>
class cob_3d_features::KNNClassifier< PointT >

k-nearest-neighbor classifier

Definition at line 73 of file knn_classifier.h.


Member Typedef Documentation

template<typename PointT >
typedef pcl::KdTree<PointT> cob_3d_features::KNNClassifier< PointT >::KdTree

Definition at line 84 of file knn_classifier.h.

template<typename PointT >
typedef boost::shared_ptr<KdTree> cob_3d_features::KNNClassifier< PointT >::KdTreePtr

Definition at line 85 of file knn_classifier.h.

template<typename PointT >
typedef pcl::PointCloud<PointT> cob_3d_features::KNNClassifier< PointT >::PointCloud

Definition at line 81 of file knn_classifier.h.

template<typename PointT >
typedef boost::shared_ptr<const PointCloud> cob_3d_features::KNNClassifier< PointT >::PointCloudConstPtr

Definition at line 83 of file knn_classifier.h.

template<typename PointT >
typedef boost::shared_ptr<PointCloud> cob_3d_features::KNNClassifier< PointT >::PointCloudPtr

Definition at line 82 of file knn_classifier.h.


Constructor & Destructor Documentation

template<typename PointT >
KNNClassifier::KNNClassifier ( )

Empty constructor

Definition at line 82 of file knn_classifier.cpp.

template<typename PointT >
KNNClassifier::~KNNClassifier ( )

Empty destructor

Definition at line 87 of file knn_classifier.cpp.


Member Function Documentation

template<typename PointT >
int KNNClassifier::classify ( const PointT p_q)

classify a single point using the loaded training data

Parameters:
[in]p_qa feature point to be classified
Returns:
the predicted label

Definition at line 209 of file knn_classifier.cpp.

template<typename PointT >
int KNNClassifier::loadTrainingData ( std::string &  features_file_name,
std::string &  labels_file_name 
)

load the training data and labels

Parameters:
[in]features_file_namepath to features file
[in]labels_file_namepath to labels file

Definition at line 186 of file knn_classifier.cpp.

template<typename PointT >
int KNNClassifier::saveTrainingData ( std::string &  features_file_name,
std::string &  labels_file_name 
)

save the loaded training data and labels

Parameters:
[in]features_file_namepath where the features should be saved
[in]labels_file_namepath where the labels should be saved

Definition at line 169 of file knn_classifier.cpp.

template<typename PointT >
void KNNClassifier::setKNeighbors ( int  k)

set the k neighbors to search for

Definition at line 163 of file knn_classifier.cpp.

template<typename PointT >
void KNNClassifier::setTrainingFeatures ( const PointCloudPtr features,
std::string &  distanceMetric = "L2" 
)

Set a point cloud containing the features samples.

Parameters:
[in]featuresinput feature point cloud
[in]distanceMetricL2, L1, HIK, ChiSpuare, Hellinger at the moment only L2 works with the default PCL

Definition at line 146 of file knn_classifier.cpp.

template<typename PointT >
void KNNClassifier::setTrainingLabels ( const std::vector< int > &  labels)

setTrainingLabels

Definition at line 156 of file knn_classifier.cpp.


Member Data Documentation

template<typename PointT >
std::string cob_3d_features::KNNClassifier< PointT >::distanceMetric_ [protected]

Definition at line 136 of file knn_classifier.h.

template<typename PointT >
int cob_3d_features::KNNClassifier< PointT >::k_ [protected]

Definition at line 138 of file knn_classifier.h.

template<typename PointT >
std::vector<int> cob_3d_features::KNNClassifier< PointT >::labels_ [protected]

Definition at line 135 of file knn_classifier.h.

template<typename PointT >
int cob_3d_features::KNNClassifier< PointT >::labels_max_ [protected]

Definition at line 137 of file knn_classifier.h.

template<typename PointT >
KdTreePtr cob_3d_features::KNNClassifier< PointT >::tree_ [protected]

Definition at line 134 of file knn_classifier.h.


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


cob_3d_features
Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:02:26