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>
110 findStrongestPeaks (std::vector<
ISMPeak, Eigen::aligned_allocator<ISMPeak> > &out_peaks,
int in_class_id,
double in_non_maxima_radius,
double in_sigma);
117 getDensityAtPoint (
const PointT &point,
double sigma_dist);
130 shiftMean (
const Eigen::Vector3f& snapPt,
const double in_dSigmaDist);
165 ISMModel (ISMModel
const & copy);
175 saveModelToFile (std::string& file_name);
181 loadModelFromfile (std::string& file_name);
188 ISMModel & operator = (
const ISMModel& other);
223 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
240 template <
int FeatureSize,
typename Po
intT,
typename NormalT = pcl::Normal>
259 model_num_ (model_num),
260 dir_to_center_ (dir_to_center),
265 unsigned int model_num_;
279 typedef struct PCL_EXPORTS
TC
292 TC(
int type,
int max_count,
float epsilon) :
294 max_count_ (max_count),
295 epsilon_ (epsilon) {};
318 learned_weight_ (0.0f),
319 dir_to_center_ (0.0f, 0.0f, 0.0f) {};
341 std::vector<typename pcl::PointCloud<PointT>::Ptr>
342 getTrainingClouds ();
351 std::vector<unsigned int>
352 getTrainingClasses ();
358 setTrainingClasses (
const std::vector<unsigned int>& training_classes);
361 std::vector<typename pcl::PointCloud<NormalT>::Ptr>
362 getTrainingNormals ();
378 setSamplingSize (
float sampling_size);
381 boost::shared_ptr<pcl::Feature<PointT, pcl::Histogram<FeatureSize> > >
382 getFeatureEstimator ();
393 getNumberOfClusters ();
399 setNumberOfClusters (
unsigned int num_of_clusters);
412 setSigmaDists (
const std::vector<float>& training_sigmas);
425 setNVotState (
bool state);
441 boost::shared_ptr<pcl::features::ISMVoteList<PointT> >
453 std::vector<
LocationInfo, Eigen::aligned_allocator<LocationInfo> >& locations);
461 clusterDescriptors (std::vector<
pcl::Histogram<FeatureSize> >& histograms, Eigen::MatrixXi& labels, Eigen::MatrixXf& clusters_centers);
467 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);
542 computeKMeansClustering (
const Eigen::MatrixXf& points_to_cluster,
543 int number_of_clusters,
544 Eigen::MatrixXi& io_labels,
548 Eigen::MatrixXf& cluster_centers);
558 generateCentersPP (
const Eigen::MatrixXf& data,
559 Eigen::MatrixXf& out_centers,
560 int number_of_clusters,
568 generateRandomCenter (
const std::vector<Eigen::Vector2f>& boxes, Eigen::VectorXf& center);
575 computeDistance (Eigen::VectorXf& vec_1, Eigen::VectorXf& vec_2);
612 static const int PP_CENTERS = 2;
616 static const int USE_INITIAL_LABELS = 1;
625 (
float, density, ism_density)
626 (
float, class_id, ism_class_id)
629 #endif //#ifndef PCL_IMPLICIT_SHAPE_MODEL_H_