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