Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition to standard smart pointers, part 14 #3497

Merged
merged 6 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h>
#include <pcl/features/crh.h>

#include <memory>

namespace pcl
{
namespace rec_3d_framework
Expand All @@ -23,7 +25,7 @@ namespace pcl
using GlobalEstimator<PointInT, FeatureT>::normal_estimator_;
using GlobalEstimator<PointInT, FeatureT>::normals_;

typename boost::shared_ptr<GlobalEstimator<PointInT, FeatureT> > feature_estimator_;
std::shared_ptr<GlobalEstimator<PointInT, FeatureT>> feature_estimator_;
using CRHPointCloud = pcl::PointCloud<pcl::Histogram<90> >;
std::vector< CRHPointCloud::Ptr > crh_histograms_;

Expand All @@ -35,7 +37,7 @@ namespace pcl
}

void
setFeatureEstimator(typename boost::shared_ptr<GlobalEstimator<PointInT, FeatureT> > & feature_estimator) {
setFeatureEstimator(std::shared_ptr<GlobalEstimator<PointInT, FeatureT>>& feature_estimator) {
feature_estimator_ = feature_estimator;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include <pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h>

#include <memory>

namespace pcl
{
namespace rec_3d_framework
Expand All @@ -20,7 +22,7 @@ namespace pcl
using PointInTPtr = typename pcl::PointCloud<PointInT>::Ptr;
using FeatureTPtr = typename pcl::PointCloud<FeatureT>::Ptr;

typename boost::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal> > normal_estimator_;
std::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal>> normal_estimator_;

pcl::PointCloud<pcl::Normal>::Ptr normals_;

Expand All @@ -34,7 +36,7 @@ namespace pcl

virtual bool computedNormals() = 0;

void setNormalEstimator(boost::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal> > & ne) {
void setNormalEstimator(std::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal>>& ne) {
normal_estimator_ = ne;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <pcl/keypoints/sift_keypoint.h>
#include <pcl/keypoints/susan.h>

#include <memory>

namespace pcl
{
template<>
Expand Down Expand Up @@ -83,8 +85,8 @@ namespace pcl
using KeypointExtractor<PointInT>::input_;
using KeypointExtractor<PointInT>::radius_;
float sampling_density_;
boost::shared_ptr<std::vector<std::vector<int> > > neighborhood_indices_;
boost::shared_ptr<std::vector<std::vector<float> > > neighborhood_dist_;
std::shared_ptr<std::vector<std::vector<int>>> neighborhood_indices_;
std::shared_ptr<std::vector<std::vector<float>>> neighborhood_dist_;

void
filterPlanar (PointInTPtr & input, PointInTPtr & keypoints_cloud)
Expand Down Expand Up @@ -380,19 +382,15 @@ namespace pcl
using PointInTPtr = typename pcl::PointCloud<PointInT>::Ptr;
using FeatureTPtr = typename pcl::PointCloud<FeatureT>::Ptr;

typename boost::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal> > normal_estimator_;
//typename boost::shared_ptr<UniformSampling<PointInT> > keypoint_extractor_;
std::vector<typename boost::shared_ptr<KeypointExtractor<PointInT> > > keypoint_extractor_; //this should be a vector
std::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal>> normal_estimator_;
std::vector<std::shared_ptr<KeypointExtractor<PointInT>>> keypoint_extractor_; //this should be a vector
float support_radius_;
//bool filter_planar_;

bool adaptative_MLS_;

boost::shared_ptr<std::vector<std::vector<int> > > neighborhood_indices_;
boost::shared_ptr<std::vector<std::vector<float> > > neighborhood_dist_;

//std::vector< std::vector<int> > neighborhood_indices_;
//std::vector< std::vector<float> > neighborhood_dist_;
std::shared_ptr<std::vector<std::vector<int>>> neighborhood_indices_;
std::shared_ptr<std::vector<std::vector<float>>> neighborhood_dist_;

void
computeKeypoints (PointInTPtr & cloud, PointInTPtr & keypoints, pcl::PointCloud<pcl::Normal>::Ptr & normals)
Expand Down Expand Up @@ -433,7 +431,7 @@ namespace pcl
estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures)=0;

void
setNormalEstimator (boost::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal> > & ne)
setNormalEstimator (std::shared_ptr<PreProcessorAndNormalEstimator<PointInT, pcl::Normal>> & ne)
{
normal_estimator_ = ne;
}
Expand All @@ -442,13 +440,13 @@ namespace pcl
* \brief Right now only uniformSampling keypoint extractor is allowed
*/
void
addKeypointExtractor (boost::shared_ptr<KeypointExtractor<PointInT> > & ke)
addKeypointExtractor (std::shared_ptr<KeypointExtractor<PointInT>>& ke)
{
keypoint_extractor_.push_back (ke);
}

void
setKeypointExtractors (std::vector<typename boost::shared_ptr<KeypointExtractor<PointInT> > > & ke)
setKeypointExtractors (std::vector<std::shared_ptr<KeypointExtractor<PointInT>>>& ke)
{
keypoint_extractor_ = ke;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ namespace pcl
using PointTPtrConst = typename pcl::PointCloud<PointT>::ConstPtr;

public:
boost::shared_ptr<std::vector<PointTPtr> > views_;
boost::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > > poses_;
boost::shared_ptr<std::vector<float> > self_occlusions_;
std::shared_ptr<std::vector<PointTPtr>> views_;
std::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>> poses_;
std::shared_ptr<std::vector<float>> self_occlusions_;
std::string id_;
std::string class_;
PointTPtr assembled_;
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace pcl
protected:
using ModelT = Model<PointInT>;
std::string path_;
boost::shared_ptr<std::vector<ModelT> > models_;
std::shared_ptr<std::vector<ModelT>> models_;
float model_scale_;
bool filter_duplicate_views_;
bool load_views_;
Expand Down Expand Up @@ -215,13 +215,13 @@ namespace pcl
/**
* \brief Get the generated model
*/
boost::shared_ptr<std::vector<ModelT> >
std::shared_ptr<std::vector<ModelT>>
getModels ()
{
return models_;
}

boost::shared_ptr<std::vector<ModelT> >
std::shared_ptr<std::vector<ModelT>>
getModels (std::string & model_id)
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ namespace pcl
PointInTPtr input_;

/** \brief Model data source */
typename boost::shared_ptr<pcl::rec_3d_framework::Source<PointInT> > source_;
std::shared_ptr<pcl::rec_3d_framework::Source<PointInT>> source_;

/** \brief Computes a feature */
typename boost::shared_ptr<GlobalEstimator<PointInT, FeatureT> > estimator_;
std::shared_ptr<GlobalEstimator<PointInT, FeatureT>> estimator_;

/** \brief Descriptor name */
std::string descr_name_;
Expand Down Expand Up @@ -176,7 +176,7 @@ namespace pcl
* \brief Sets the model data source_
*/
void
setDataSource (typename boost::shared_ptr<Source<PointInT> > & source)
setDataSource (std::shared_ptr<Source<PointInT>>& source)
{
source_ = source;
}
Expand All @@ -186,7 +186,7 @@ namespace pcl
*/

void
setFeatureEstimator (typename boost::shared_ptr<GlobalEstimator<PointInT, FeatureT> > & feat)
setFeatureEstimator (std::shared_ptr<GlobalEstimator<PointInT, FeatureT>>& feat)
{
estimator_ = feat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ namespace pcl
PointInTPtr input_;

/** \brief Model data source */
typename boost::shared_ptr<pcl::rec_3d_framework::Source<PointInT> > source_;
std::shared_ptr<pcl::rec_3d_framework::Source<PointInT>> source_;

/** \brief Computes a feature */
typename boost::shared_ptr<CRHEstimation<PointInT, FeatureT> > crh_estimator_;
std::shared_ptr<CRHEstimation<PointInT, FeatureT>> crh_estimator_;

/** \brief Hypotheses verification algorithm */
typename boost::shared_ptr<HypothesisVerification<PointInT, PointInT> > hv_algorithm_;
std::shared_ptr<HypothesisVerification<PointInT, PointInT>> hv_algorithm_;

/** \brief Descriptor name */
std::string descr_name_;
Expand Down Expand Up @@ -139,8 +139,8 @@ namespace pcl

int NN_;

boost::shared_ptr<std::vector<ModelT> > models_;
boost::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > > transforms_;
std::shared_ptr<std::vector<ModelT>> models_;
std::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>> transforms_;

public:

Expand Down Expand Up @@ -187,7 +187,7 @@ namespace pcl
* \brief Sets the model data source_
*/
void
setDataSource (typename boost::shared_ptr<Source<PointInT> > & source)
setDataSource (std::shared_ptr<Source<PointInT>>& source)
{
source_ = source;
}
Expand All @@ -197,7 +197,7 @@ namespace pcl
*/

void
setFeatureEstimator (typename boost::shared_ptr<CRHEstimation<PointInT, FeatureT> > & feat)
setFeatureEstimator (std::shared_ptr<CRHEstimation<PointInT, FeatureT>>& feat)
{
crh_estimator_ = feat;
}
Expand All @@ -206,7 +206,7 @@ namespace pcl
* \brief Sets the HV algorithm
*/
void
setHVAlgorithm (typename boost::shared_ptr<HypothesisVerification<PointInT, PointInT> > & alg)
setHVAlgorithm (std::shared_ptr<HypothesisVerification<PointInT, PointInT>>& alg)
{
hv_algorithm_ = alg;
}
Expand Down Expand Up @@ -245,13 +245,13 @@ namespace pcl
void
recognize ();

boost::shared_ptr<std::vector<ModelT> >
std::shared_ptr<std::vector<ModelT>>
getModels ()
{
return models_;
}

boost::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > >
std::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>>
getTransforms ()
{
return transforms_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ namespace pcl
PointInTPtr input_;

/** \brief Model data source */
typename boost::shared_ptr<pcl::rec_3d_framework::Source<PointInT> > source_;
std::shared_ptr<pcl::rec_3d_framework::Source<PointInT>> source_;

/** \brief Computes a feature */
typename boost::shared_ptr<OURCVFHEstimator<PointInT, FeatureT> > micvfh_estimator_;
std::shared_ptr<OURCVFHEstimator<PointInT, FeatureT>> micvfh_estimator_;

/** \brief Hypotheses verification algorithm */
typename boost::shared_ptr<HypothesisVerification<PointInT, PointInT> > hv_algorithm_;
std::shared_ptr<HypothesisVerification<PointInT, PointInT>> hv_algorithm_;

/** \brief Descriptor name */
std::string descr_name_;
Expand Down Expand Up @@ -126,7 +126,7 @@ namespace pcl

std::vector<flann::Matrix<float> > single_categories_data_;
std::vector<flann::Index<DistT> *> single_categories_index_;
std::vector<boost::shared_ptr<std::vector<int> > > single_categories_pointers_to_models_;
std::vector<std::shared_ptr<std::vector<int>>> single_categories_pointers_to_models_;
std::map<std::string, int> category_to_vectors_indices_;
std::vector<std::string> categories_to_be_searched_;
bool use_single_categories_;
Expand Down Expand Up @@ -163,7 +163,7 @@ namespace pcl
}

inline void
convertToFLANN (const std::vector<flann_model> &models, const boost::shared_ptr<std::vector<int> > & indices, flann::Matrix<float> &data)
convertToFLANN (const std::vector<flann_model> &models, const std::shared_ptr<std::vector<int>>& indices, flann::Matrix<float> &data)
{
data.rows = indices->size ();
data.cols = models[0].descr.size (); // number of histogram bins
Expand Down Expand Up @@ -196,8 +196,8 @@ namespace pcl

int NN_;

boost::shared_ptr<std::vector<ModelT> > models_;
boost::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > > transforms_;
std::shared_ptr<std::vector<ModelT>> models_;
std::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>> transforms_;

std::vector<float> descriptor_distances_;

Expand Down Expand Up @@ -268,7 +268,7 @@ namespace pcl
* \brief Sets the model data source_
*/
void
setDataSource (typename boost::shared_ptr<Source<PointInT> > & source)
setDataSource (std::shared_ptr<Source<PointInT>>& source)
{
source_ = source;
}
Expand All @@ -278,7 +278,7 @@ namespace pcl
*/

void
setFeatureEstimator (typename boost::shared_ptr<OURCVFHEstimator<PointInT, FeatureT> > & feat)
setFeatureEstimator (std::shared_ptr<OURCVFHEstimator<PointInT, FeatureT>>& feat)
{
micvfh_estimator_ = feat;
}
Expand All @@ -287,7 +287,7 @@ namespace pcl
* \brief Sets the HV algorithm
*/
void
setHVAlgorithm (typename boost::shared_ptr<HypothesisVerification<PointInT, PointInT> > & alg)
setHVAlgorithm (std::shared_ptr<HypothesisVerification<PointInT, PointInT>>& alg)
{
hv_algorithm_ = alg;
}
Expand Down Expand Up @@ -326,13 +326,13 @@ namespace pcl
void
recognize ();

boost::shared_ptr<std::vector<ModelT> >
std::shared_ptr<std::vector<ModelT>>
getModels ()
{
return models_;
}

boost::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > >
std::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>>
getTransforms ()
{
return transforms_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
void
pcl::rec_3d_framework::GlobalNNPipeline<Distance, PointInT, FeatureT>::loadFeaturesAndCreateFLANN ()
{
boost::shared_ptr < std::vector<ModelT> > models = source_->getModels ();
auto models = source_->getModels ();
for (std::size_t i = 0; i < models->size (); i++)
{
std::string path = source_->getModelDescriptorDir (models->at (i), training_dir_, descr_name_);
Expand Down Expand Up @@ -160,7 +160,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>

//use the source to know what has to be trained and what not, checking if the descr_name directory exists
//unless force_retrain is true, then train everything
boost::shared_ptr < std::vector<ModelT> > models = source_->getModels ();
auto models = source_->getModels ();
std::cout << "Models size:" << models->size () << std::endl;

if (force_retrain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
void
pcl::rec_3d_framework::GlobalNNCRHRecognizer<Distance, PointInT, FeatureT>::loadFeaturesAndCreateFLANN ()
{
boost::shared_ptr < std::vector<ModelT> > models = source_->getModels ();
auto models = source_->getModels ();
for (std::size_t i = 0; i < models->size (); i++)
{
std::string path = source_->getModelDescriptorDir (models->at (i), training_dir_, descr_name_);
Expand Down Expand Up @@ -371,8 +371,8 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
hv_algorithm_->verify ();
hv_algorithm_->getMask (mask_hv);

boost::shared_ptr < std::vector<ModelT> > models_temp;
boost::shared_ptr < std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > > transforms_temp;
std::shared_ptr<std::vector<ModelT>> models_temp;
std::shared_ptr<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>> transforms_temp;

models_temp.reset (new std::vector<ModelT>);
transforms_temp.reset (new std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> >);
Expand Down Expand Up @@ -400,7 +400,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>

//use the source to know what has to be trained and what not, checking if the descr_name directory exists
//unless force_retrain is true, then train everything
boost::shared_ptr < std::vector<ModelT> > models = source_->getModels ();
auto models = source_->getModels ();
std::cout << "Models size:" << models->size () << std::endl;

if (force_retrain)
Expand Down
Loading