40 #include <Eigen/src/Core/Matrix.h>
44 #include <pcl/point_representation.h>
45 #include <pcl/features/feature.h>
46 #include <pcl/kdtree/kdtree_flann.h>
69 template <
typename Po
intT>
74 using Ptr = shared_ptr<ISMVoteList<PointT> >;
75 using ConstPtr = shared_ptr<const ISMVoteList<PointT>>;
106 findStrongestPeaks (std::vector<
ISMPeak, Eigen::aligned_allocator<ISMPeak> > &out_peaks,
int in_class_id,
double in_non_maxima_radius,
double in_sigma);
113 getDensityAtPoint (
const PointT &point,
double sigma_dist);
126 shiftMean (
const Eigen::Vector3f& snapPt,
const double in_dSigmaDist);
134 bool tree_is_valid_{
false};
140 std::vector<int> votes_class_{};
149 std::vector<float> k_sqr_dist_{};
157 using Ptr = shared_ptr<ISMModel>;
174 saveModelToFile (std::string& file_name);
180 loadModelFromfile (std::string& file_name);
190 std::vector<std::vector<float> > statistical_weights_{};
193 std::vector<float> learned_weights_{};
196 std::vector<unsigned int> classes_{};
199 std::vector<float> sigmas_{};
208 std::vector<std::vector<unsigned int> > clusters_{};
211 unsigned int number_of_classes_{0};
214 unsigned int number_of_visual_words_{0};
217 unsigned int number_of_clusters_{0};
220 unsigned int descriptors_dimension_{0};
240 template <
int FeatureSize,
typename Po
intT,
typename NormalT = pcl::Normal>
261 model_num_ (model_num),
262 dir_to_center_ (dir_to_center),
296 max_count_ (max_count),
297 epsilon_ (epsilon) {};
320 dir_to_center_ (0.0f, 0.0f, 0.0f) {};
326 float learned_weight_{0.0f};
342 std::vector<typename pcl::PointCloud<PointT>::Ptr>
343 getTrainingClouds ();
352 std::vector<unsigned int>
353 getTrainingClasses ();
359 setTrainingClasses (
const std::vector<unsigned int>& training_classes);
362 std::vector<typename pcl::PointCloud<NormalT>::Ptr>
363 getTrainingNormals ();
379 setSamplingSize (
float sampling_size);
383 getFeatureEstimator ();
394 getNumberOfClusters ();
400 setNumberOfClusters (
unsigned int num_of_clusters);
413 setSigmaDists (
const std::vector<float>& training_sigmas);
426 setNVotState (
bool state);
454 std::vector<
LocationInfo, Eigen::aligned_allocator<LocationInfo> >& locations);
462 clusterDescriptors (std::vector<
pcl::Histogram<FeatureSize> >& histograms, Eigen::MatrixXi& labels, Eigen::MatrixXf& clusters_centers);
468 calculateSigmas (std::vector<float>& sigmas);
481 calculateWeights (
const std::vector<
LocationInfo, Eigen::aligned_allocator<LocationInfo> >& locations,
482 const Eigen::MatrixXi &labels,
483 std::vector<float>& sigmas,
484 std::vector<std::vector<unsigned int> >& clusters,
485 std::vector<std::vector<float> >& statistical_weights,
486 std::vector<float>& learned_weights);
513 alignYCoordWithNormal (
const NormalT& in_normal);
520 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, Eigen::aligned_allocator<Eigen::Vector2f> >& boxes, Eigen::VectorXf& center);
576 computeDistance (Eigen::VectorXf& vec_1, Eigen::VectorXf& vec_2);
585 std::vector<typename pcl::PointCloud<PointT>::Ptr> training_clouds_{};
588 std::vector<unsigned int> training_classes_{};
591 std::vector<typename pcl::PointCloud<NormalT>::Ptr> training_normals_{};
596 std::vector<float> training_sigmas_{};
599 float sampling_size_{0.1f};
605 unsigned int number_of_clusters_{184};
608 bool n_vot_ON_{
true};
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)
Feature represents the base feature class.
shared_ptr< Feature< PointInT, PointOutT > > Ptr
shared_ptr< KdTreeFLANN< PointT, Dist > > Ptr
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
This class is used for storing, analyzing and manipulating votes obtained from ISM algorithm.
shared_ptr< ISMVoteList< PointT > > Ptr
shared_ptr< const ISMVoteList< PointT > > ConstPtr
ISMVoteList()
Empty constructor with member variables initialization.
This class implements Implicit Shape Model algorithm described in "Hough Transforms and 3D SURF for r...
typename Feature::Ptr FeaturePtr
pcl::features::ISMModel::Ptr ISMModelPtr
ImplicitShapeModelEstimation()
Simple constructor that initializes everything.
Feature::Ptr feature_estimator_
Stores the feature estimator.
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
IndicesAllocator<> Indices
Type used for indices in PCL.
Defines all the PCL and non-PCL macros used.
A point structure representing an N-D histogram.
This struct is used for storing peak.
PCL_ADD_POINT4D
Point were this peak is located.
double density
Density of this peak.
int class_id
Determines which class this peak belongs.
A point structure representing an interest point with Euclidean xyz coordinates, and an interest valu...
A point structure representing normal coordinates and the surface curvature estimate.
A point structure representing Euclidean xyz coordinates.
A point structure representing Euclidean xyz coordinates, and the RGB color.
The assignment of this structure is to store the statistical/learned weights and other information of...
shared_ptr< ISMModel > Ptr
shared_ptr< const ISMModel > ConstPtr
Eigen::MatrixXf clusters_centers_
Stores the centers of the clusters that were obtained during the visual words clusterization.
ISMModel()
Simple constructor that initializes the structure.
Eigen::MatrixXf directions_to_center_
Stores the directions to objects center for each visual word.
This structure stores the information about the keypoint.
NormalT normal_
Stores the normal of the initial point.
unsigned int model_num_
Tells from which training model this keypoint was extracted.
PointT point_
Stores the initial point.
LocationInfo(unsigned int model_num, const PointT &dir_to_center, const PointT &origin, const NormalT &normal)
Location info constructor.
PointT dir_to_center_
Expected direction to center for this keypoint.
This structure is used for determining the end of the k-means clustering process.
int type_
Flag that determines when the k-means clustering must be stopped.
float epsilon_
Defines the accuracy for k-means clustering.
TermCriteria(int type, int max_count, float epsilon)
Termination criteria constructor.
int max_count_
Defines maximum number of iterations for k-means clustering.
Structure for storing the visual word.
pcl::PointXYZ dir_to_center_
Expected direction to center.
VisualWordStat()
Empty constructor with member variables initialization.