36 #ifndef PCL_IMPLICIT_SHAPE_MODEL_H_
37 #define PCL_IMPLICIT_SHAPE_MODEL_H_
42 #include <Eigen/src/Core/Matrix.h>
43 #include <pcl/pcl_base.h>
44 #include <pcl/point_types.h>
45 #include <pcl/point_representation.h>
46 #include <pcl/features/feature.h>
47 #include <pcl/features/spin_image.h>
48 #include <pcl/filters/voxel_grid.h>
49 #include <pcl/filters/extract_indices.h>
50 #include <pcl/search/search.h>
51 #include <pcl/kdtree/kdtree.h>
52 #include <pcl/kdtree/kdtree_flann.h>
53 #include <pcl/kdtree/impl/kdtree_flann.hpp>
69 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
76 template <
typename Po
intT>
109 findStrongestPeaks (std::vector<
ISMPeak, Eigen::aligned_allocator<ISMPeak> > &out_peaks,
int in_class_id,
double in_non_maxima_radius,
double in_sigma);
116 getDensityAtPoint (
const PointT &point,
double sigma_dist);
129 shiftMean (
const Eigen::Vector3f& snapPt,
const double in_dSigmaDist);
164 ISMModel (ISMModel
const & copy);
174 saveModelToFile (std::string& file_name);
180 loadModelFromfile (std::string& file_name);
187 ISMModel & operator = (
const ISMModel& other);
222 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
239 template <
int FeatureSize,
typename Po
intT,
typename NormalT = pcl::Normal>
258 model_num_ (model_num),
259 dir_to_center_ (dir_to_center),
264 unsigned int model_num_;
278 typedef struct PCL_EXPORTS
TC
291 TC(
int type,
int max_count,
float epsilon) :
293 max_count_ (max_count),
294 epsilon_ (epsilon) {};
317 learned_weight_ (0.0f),
318 dir_to_center_ (0.0f, 0.0f, 0.0f) {};
340 std::vector<typename pcl::PointCloud<PointT>::Ptr>
341 getTrainingClouds ();
350 std::vector<unsigned int>
351 getTrainingClasses ();
357 setTrainingClasses (
const std::vector<unsigned int>& training_classes);
360 std::vector<typename pcl::PointCloud<NormalT>::Ptr>
361 getTrainingNormals ();
377 setSamplingSize (
float sampling_size);
380 boost::shared_ptr<pcl::Feature<PointT, pcl::Histogram<FeatureSize> > >
381 getFeatureEstimator ();
392 getNumberOfClusters ();
398 setNumberOfClusters (
unsigned int num_of_clusters);
411 setSigmaDists (
const std::vector<float>& training_sigmas);
424 setNVotState (
bool state);
440 boost::shared_ptr<pcl::features::ISMVoteList<PointT> >
452 std::vector<
LocationInfo, Eigen::aligned_allocator<LocationInfo> >& locations);
460 clusterDescriptors (std::vector<
pcl::Histogram<FeatureSize> >& histograms, Eigen::MatrixXi& labels, Eigen::MatrixXf& clusters_centers);
466 calculateSigmas (std::vector<float>& sigmas);
480 calculateWeights (
const std::vector<
LocationInfo, Eigen::aligned_allocator<LocationInfo> >& locations,
481 const Eigen::MatrixXi &labels,
482 std::vector<float>& sigmas,
483 std::vector<std::vector<unsigned int> >& clusters,
484 std::vector<std::vector<float> >& statistical_weights,
485 std::vector<float>& learned_weights);
512 alignYCoordWithNormal (
const NormalT& in_normal);
519 applyTransform (Eigen::Vector3f& io_vec,
const Eigen::Matrix3f& in_transform);
543 computeKMeansClustering (
const Eigen::MatrixXf& points_to_cluster,
544 int number_of_clusters,
545 Eigen::MatrixXi& io_labels,
549 Eigen::MatrixXf& cluster_centers);
559 generateCentersPP (
const Eigen::MatrixXf& data,
560 Eigen::MatrixXf& out_centers,
561 int number_of_clusters,
569 generateRandomCenter (
const std::vector<Eigen::Vector2f>& boxes, Eigen::VectorXf& center);
576 computeDistance (Eigen::VectorXf& vec_1, Eigen::VectorXf& vec_2);
613 static const int PP_CENTERS = 2;
617 static const int USE_INITIAL_LABELS = 1;
626 (
float, density, ism_density)
627 (
float, class_id, ism_class_id)
630 #endif //#ifndef PCL_IMPLICIT_SHAPE_MODEL_H_