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_
float epsilon_
Defines the accuracy for k-means clustering.
This structure stores the information about the keypoint.
bool tree_is_valid_
Signalizes if the tree is valid.
Eigen::MatrixXf clusters_centers_
Stores the centers of the clusters that were obtained during the visual words clusterization.
float sampling_size_
This value is used for the simplification.
A point structure representing an interest point with Euclidean xyz coordinates, and an interest valu...
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
This class implements Implicit Shape Model algorithm described in "Hough Transforms and 3D SURF for r...
pcl::PointCloud< PointT >::Ptr votes_origins_
Stores the origins of the votes.
std::vector< typename pcl::PointCloud< PointT >::Ptr > training_clouds_
Stores the clouds used for training.
unsigned int descriptors_dimension_
Stores descriptors dimension.
boost::shared_ptr< PointCloud< PointT > > Ptr
boost::shared_ptr< KdTreeFLANN< PointT > > Ptr
float learned_weight_
Weight of the vote.
A point structure representing an N-D histogram.
boost::shared_ptr< pcl::features::ISMModel > ISMModelPtr
unsigned int number_of_visual_words_
Stores the number of visual words.
pcl::PointCloud< pcl::InterestPoint >::Ptr votes_
Stores all votes.
This class is used for storing, analyzing and manipulating votes obtained from ISM algorithm...
std::vector< std::vector< unsigned int > > clusters_
This is an array of clusters.
struct pcl::_PointXYZHSV EIGEN_ALIGN16
std::vector< typename pcl::PointCloud< NormalT >::Ptr > training_normals_
Stores the normals for each training cloud.
std::vector< float > training_sigmas_
This array stores the sigma values for each training class.
double density
Density of this peak.
NormalT normal_
Stores the normal of the initial point.
LocationInfo(unsigned int model_num, const PointT &dir_to_center, const PointT &origin, const NormalT &normal)
Location info constructor.
A point structure representing normal coordinates and the surface curvature estimate.
std::vector< float > learned_weights_
Stores learned weights.
std::vector< int > votes_class_
Stores classes for which every single vote was cast.
std::vector< float > k_sqr_dist_
Stores square distances to the corresponding neighbours.
std::vector< int > k_ind_
Stores neighbours indices.
TC(int type, int max_count, float epsilon)
Termination criteria constructor.
Eigen::MatrixXf directions_to_center_
Stores the directions to objects center for each visual word.
pcl::PointXYZ dir_to_center_
Expected direction to center.
PointT dir_to_center_
Expected direction to center for this keypoint.
std::vector< std::vector< float > > statistical_weights_
Stores statistical weights.
unsigned int number_of_clusters_
Stores the number of clusters.
This struct is used for storing peak.
struct PCL_EXPORTS pcl::ism::ImplicitShapeModelEstimation::TC TermCriteria
This structure is used for determining the end of the k-means clustering process. ...
bool n_vot_ON_
If set to false then Nvot coeff from [Knopp et al., 2010, (4)] is equal 1.0.
VisualWordStat()
Empty constructor with member variables initialization.
Feature represents the base feature class.
std::vector< float > sigmas_
Stores the sigma value for each class.
unsigned int number_of_classes_
Stores the number of classes.
A point structure representing Euclidean xyz coordinates, and the RGB color.
int class_id
Determines which class this peak belongs.
PCL_ADD_POINT4D
Point were this peak is located.
int max_count_
Defines maximum number of iterations for k-means clustering.
This structure is used for determining the end of the k-means clustering process. ...
A point structure representing Euclidean xyz coordinates.
std::vector< unsigned int > classes_
Stores the class label for every direction.
pcl::KdTreeFLANN< pcl::InterestPoint >::Ptr tree_
Stores the search tree.
Structure for storing the visual word.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
The assignment of this structure is to store the statistical/learned weights and other information of...
boost::shared_ptr< pcl::Feature< PointT, pcl::Histogram< FeatureSize > > > feature_estimator_
Stores the feature estimator.
PointT point_
Stores the initial point.
unsigned int number_of_clusters_
Number of clusters, is used for clustering descriptors during the training.
std::vector< unsigned int > training_classes_
Stores the class number for each cloud from training_clouds_.