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 4 #2929

Merged
merged 3 commits into from
Mar 25, 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
3 changes: 1 addition & 2 deletions apps/src/openni_tracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ class OpenNISegmentTracking
// NearestPairPointCloudCoherence<RefPointType>::Ptr coherence = NearestPairPointCloudCoherence<RefPointType>::Ptr
// (new NearestPairPointCloudCoherence<RefPointType> ());

boost::shared_ptr<DistanceCoherence<RefPointType> > distance_coherence
= boost::shared_ptr<DistanceCoherence<RefPointType> > (new DistanceCoherence<RefPointType> ());
DistanceCoherence<RefPointType>::Ptr distance_coherence (new DistanceCoherence<RefPointType>);
coherence->addPointCoherence (distance_coherence);

boost::shared_ptr<HSVColorCoherence<RefPointType> > color_coherence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ main (int argc, char** argv)
ism.setTrainingClasses (training_classes);
ism.setSamplingSize (2.0f);

pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal>::ISMModelPtr model = boost::shared_ptr<pcl::features::ISMModel>
(new pcl::features::ISMModel);
pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal>::ISMModelPtr model (new pcl::features::ISMModel);
ism.trainISM (model);

std::string file ("trained_ism_model.txt");
Expand All @@ -70,7 +69,7 @@ main (int argc, char** argv)
normal_estimator.setInputCloud (testing_cloud);
normal_estimator.compute (*testing_normals);

boost::shared_ptr<pcl::features::ISMVoteList<pcl::PointXYZ> > vote_list = ism.findObjects (
pcl::features::ISMVoteList<pcl::PointXYZ>::Ptr vote_list = ism.findObjects (
model,
testing_cloud,
testing_normals,
Expand Down
16 changes: 8 additions & 8 deletions doc/tutorials/content/sources/tracking/tracking_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CloudPtr cloud_pass_downsampled_;
CloudPtr target_cloud;

boost::mutex mtx_;
boost::shared_ptr<ParticleFilter> tracker_;
ParticleFilter::Ptr tracker_;
bool new_cloud_;
double downsampling_grid_size_;
int counter;
Expand Down Expand Up @@ -209,7 +209,7 @@ main (int argc, char** argv)
std::vector<double> initial_noise_covariance = std::vector<double> (6, 0.00001);
std::vector<double> default_initial_mean = std::vector<double> (6, 0.0);

boost::shared_ptr<KLDAdaptiveParticleFilterOMPTracker<RefPointType, ParticleT> > tracker
KLDAdaptiveParticleFilterOMPTracker<RefPointType, ParticleT>::Ptr tracker
(new KLDAdaptiveParticleFilterOMPTracker<RefPointType, ParticleT> (8));

ParticleT bin_size;
Expand Down Expand Up @@ -240,14 +240,14 @@ main (int argc, char** argv)


//Setup coherence object for tracking
ApproxNearestPairPointCloudCoherence<RefPointType>::Ptr coherence = ApproxNearestPairPointCloudCoherence<RefPointType>::Ptr
(new ApproxNearestPairPointCloudCoherence<RefPointType> ());
boost::shared_ptr<DistanceCoherence<RefPointType> > distance_coherence
= boost::shared_ptr<DistanceCoherence<RefPointType> > (new DistanceCoherence<RefPointType> ());
ApproxNearestPairPointCloudCoherence<RefPointType>::Ptr coherence
(new ApproxNearestPairPointCloudCoherence<RefPointType>);

DistanceCoherence<RefPointType>::Ptr distance_coherence
(new DistanceCoherence<RefPointType>);
coherence->addPointCoherence (distance_coherence);

boost::shared_ptr<pcl::search::Octree<RefPointType> > search (new pcl::search::Octree<RefPointType> (0.01));
pcl::search::Octree<RefPointType>::Ptr search (new pcl::search::Octree<RefPointType> (0.01));
coherence->setSearchMethod (search);
coherence->setMaximumDistance (0.01);

Expand Down
5 changes: 5 additions & 0 deletions features/include/pcl/features/integral_image2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

#include <vector>

#include <boost/shared_ptr.hpp>

namespace pcl
{
template <typename DataType>
Expand Down Expand Up @@ -106,6 +108,7 @@ namespace pcl
class IntegralImage2D
{
public:
typedef boost::shared_ptr<IntegralImage2D<DataType, Dimension>> Ptr;
static const unsigned second_order_size = (Dimension * (Dimension + 1)) >> 1;
typedef Eigen::Matrix<typename IntegralImageTypeTraits<DataType>::IntegralType, Dimension, 1> ElementType;
typedef Eigen::Matrix<typename IntegralImageTypeTraits<DataType>::IntegralType, second_order_size, 1> SecondOrderType;
Expand Down Expand Up @@ -229,6 +232,8 @@ namespace pcl
class IntegralImage2D <DataType, 1>
{
public:
typedef boost::shared_ptr<IntegralImage2D<DataType, 1>> Ptr;

static const unsigned second_order_size = 1;
typedef typename IntegralImageTypeTraits<DataType>::IntegralType ElementType;
typedef typename IntegralImageTypeTraits<DataType>::IntegralType SecondOrderType;
Expand Down
4 changes: 2 additions & 2 deletions keypoints/include/pcl/keypoints/brisk_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ namespace pcl
float offset_;

/** agast */
boost::shared_ptr<pcl::keypoints::agast::OastDetector9_16> oast_detector_;
boost::shared_ptr<pcl::keypoints::agast::AgastDetector5_8> agast_detector_5_8_;
pcl::keypoints::agast::OastDetector9_16::Ptr oast_detector_;
pcl::keypoints::agast::AgastDetector5_8::Ptr agast_detector_5_8_;
};

/** BRISK Scale Space helper. */
Expand Down
2 changes: 1 addition & 1 deletion ml/include/pcl/ml/dt/decision_forest_trainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace pcl
* \param[in] dtdp The data provider that should implement getDatasetAndLabels(...) function
*/
void
setDecisionTreeDataProvider(boost::shared_ptr<pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType> > & dtdp)
setDecisionTreeDataProvider(typename pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType>::Ptr& dtdp)
{
decision_tree_trainer_.setDecisionTreeDataProvider(dtdp);
}
Expand Down
4 changes: 4 additions & 0 deletions ml/include/pcl/ml/dt/decision_tree_data_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#pragma once

#include <boost/shared_ptr.hpp>

#include <pcl/common/common.h>

namespace pcl
Expand All @@ -52,6 +54,8 @@ namespace pcl

public:

typedef boost::shared_ptr<DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType>> Ptr;

/** \brief Constructor. */
DecisionTreeTrainerDataProvider()
{
Expand Down
4 changes: 2 additions & 2 deletions ml/include/pcl/ml/dt/decision_tree_trainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace pcl
* \param[in] dtdp The data provider that should implement getDatasetAndLabels(...) function
*/
void
setDecisionTreeDataProvider (boost::shared_ptr<pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType> > & dtdp)
setDecisionTreeDataProvider (typename pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType>::Ptr& dtdp)
{
decision_tree_trainer_data_provider_ = dtdp;
}
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace pcl
/** \brief Thresholds to be used instead of generating uniform distributed thresholds. */
std::vector<float> thresholds_;
/** \brief The data provider which is called before training a specific tree, if pointer is NULL, then data_set_ is used. */
boost::shared_ptr<pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType> > decision_tree_trainer_data_provider_;
typename pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType>::Ptr decision_tree_trainer_data_provider_;
/** \brief If true, random features are generated at each node, otherwise, at start of training the tree */
bool random_features_at_split_node_;
};
Expand Down
4 changes: 4 additions & 0 deletions octree/include/pcl/octree/octree_pointcloud_changedetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

#pragma once

#include <boost/shared_ptr.hpp>

#include <pcl/octree/octree_pointcloud.h>
#include <pcl/octree/octree2buf_base.h>

Expand Down Expand Up @@ -67,6 +69,8 @@ namespace pcl

public:

typedef boost::shared_ptr<OctreePointCloudChangeDetector<PointT, LeafContainerT, BranchContainerT>> Ptr;

/** \brief Constructor.
* \param resolution_arg: octree resolution at lowest octree level
* */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pcl::people::GroundBasedPeopleDetectionApp<PointT>::compute (std::vector<pcl::pe

// Ground removal and update:
pcl::IndicesPtr inliers(new std::vector<int>);
boost::shared_ptr<pcl::SampleConsensusModelPlane<PointT> > ground_model(new pcl::SampleConsensusModelPlane<PointT>(cloud_filtered_));
typename pcl::SampleConsensusModelPlane<PointT>::Ptr ground_model (new pcl::SampleConsensusModelPlane<PointT> (cloud_filtered_));
ground_model->selectWithinDistance(ground_coeffs_transformed_, 2 * voxel_size_, *inliers);
no_ground_cloud_ = PointCloudPtr (new PointCloud);
pcl::ExtractIndices<PointT> extract;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace pcl
class TrainingExample
{
public:
std::vector<boost::shared_ptr<pcl::IntegralImage2D<float, 1> > > iimages_; //also pointer to the respective integral image
std::vector<pcl::IntegralImage2D<float, 1>::Ptr> iimages_; //also pointer to the respective integral image
int row_, col_;
int wsize_;
int label_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@

#pragma once

#include "pcl/common/common.h"
#include "pcl/recognition/face_detection/face_common.h"
#include <pcl/ml/dt/decision_tree_data_provider.h>
#include <boost/filesystem/operations.hpp>
#include <iostream>
#include <fstream>
#include <string>

#include <boost/filesystem/operations.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/algorithm/string.hpp>

#include <pcl/common/common.h>
#include <pcl/recognition/face_detection/face_common.h>
#include <pcl/ml/dt/decision_tree_data_provider.h>

namespace bf = boost::filesystem;

namespace pcl
Expand Down Expand Up @@ -124,6 +127,8 @@ namespace pcl

public:

typedef boost::shared_ptr<FaceDetectorDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType>> Ptr;

FaceDetectorDataProvider()
{
w_size_ = 80;
Expand Down
10 changes: 6 additions & 4 deletions recognition/include/pcl/recognition/hv/greedy_verification.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ namespace pcl
float regularizer_;
};

typedef boost::shared_ptr<RecognitionModel> RecognitionModelPtr;

/*
* \brief Sorts recognition models based on the number of explained scene points and visible outliers
*/
struct sortModelsClass
{
bool
operator() (const boost::shared_ptr<RecognitionModel> & n1, const boost::shared_ptr<RecognitionModel> & n2)
operator() (const RecognitionModelPtr & n1, const RecognitionModelPtr & n2)
{
float val1 = static_cast<float>(n1->good_information_) - static_cast<float>(n1->bad_information_) * n1->regularizer_;
float val2 = static_cast<float>(n2->good_information_) - static_cast<float>(n2->bad_information_) * n2->regularizer_;
Expand All @@ -93,7 +95,7 @@ namespace pcl
struct modelIndices
{
int index_;
boost::shared_ptr<RecognitionModel> model_;
RecognitionModelPtr model_;
};

/*
Expand All @@ -114,10 +116,10 @@ namespace pcl
std::vector<modelIndices> indices_models_;

/** \brief Recognition models (hypotheses to be verified) */
std::vector<boost::shared_ptr<RecognitionModel> > recognition_models_;
std::vector<RecognitionModelPtr> recognition_models_;

/** \brief Recognition models that explain a scene points. */
std::vector<std::vector<boost::shared_ptr<RecognitionModel> > > points_explained_by_rm_;
std::vector<std::vector<RecognitionModelPtr>> points_explained_by_rm_;

/** \brief Weighting for outliers */
float regularizer_;
Expand Down
11 changes: 6 additions & 5 deletions recognition/include/pcl/recognition/hv/hv_go.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace pcl
int id_;
};

typedef boost::shared_ptr<RecognitionModel> RecognitionModelPtr;
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved

typedef GlobalHypothesesVerification<ModelT, SceneT> SAOptimizerT;
class SAModel: public mets::evaluable_solution
{
Expand Down Expand Up @@ -196,7 +198,7 @@ namespace pcl
std::vector<int> explained_by_RM_; //represents the points of scene_cloud_ that are explained by the recognition models
std::vector<float> explained_by_RM_distance_weighted; //represents the points of scene_cloud_ that are explained by the recognition models
std::vector<float> unexplained_by_RM_neighboorhods; //represents the points of scene_cloud_ that are not explained by the active hypotheses in the neighboorhod of the recognition models
std::vector<boost::shared_ptr<RecognitionModel> > recognition_models_;
std::vector<RecognitionModelPtr> recognition_models_;
std::vector<size_t> indices_;

float regularizer_;
Expand Down Expand Up @@ -391,7 +393,7 @@ namespace pcl
return explained_info;
}

float getTotalBadInformation(std::vector<boost::shared_ptr<RecognitionModel> > & recog_models)
float getTotalBadInformation(std::vector<RecognitionModelPtr> & recog_models)
{
float bad_info = 0;
for (size_t i = 0; i < recog_models.size (); i++)
Expand Down Expand Up @@ -420,11 +422,10 @@ namespace pcl
evaluateSolution(const std::vector<bool> & active, int changed);

bool
addModel(typename pcl::PointCloud<ModelT>::ConstPtr & model, typename pcl::PointCloud<ModelT>::ConstPtr & complete_model,
boost::shared_ptr<RecognitionModel> & recog_model);
addModel(typename pcl::PointCloud<ModelT>::ConstPtr & model, typename pcl::PointCloud<ModelT>::ConstPtr & complete_model, RecognitionModelPtr & recog_model);

void
computeClutterCue(boost::shared_ptr<RecognitionModel> & recog_model);
computeClutterCue(RecognitionModelPtr & recog_model);

void
SAOptimize(std::vector<int> & cc_indices, std::vector<bool> & sub_solution);
Expand Down
12 changes: 7 additions & 5 deletions recognition/include/pcl/recognition/hv/hv_papazov.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace pcl
float penalty_threshold_;
float support_threshold_;

class RecognitionModel
class RecognitionModel
{
public:
std::vector<int> explained_; //indices vector referencing explained_by_RM_
Expand All @@ -75,12 +75,14 @@ namespace pcl
int id_;
};

typedef boost::shared_ptr<RecognitionModel> RecognitionModelPtr;
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved

std::vector<int> explained_by_RM_; //represents the points of scene_cloud_ that are explained by the recognition models
std::vector< boost::shared_ptr<RecognitionModel> > recognition_models_;
std::vector< std::vector <boost::shared_ptr<RecognitionModel> > > points_explained_by_rm_; //if inner size > 1, conflict
std::map<int, boost::shared_ptr<RecognitionModel> > graph_id_model_map_;
std::vector<RecognitionModelPtr> recognition_models_;
std::vector<std::vector<RecognitionModelPtr>> points_explained_by_rm_; //if inner size > 1, conflict
std::map<int, RecognitionModelPtr> graph_id_model_map_;

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::shared_ptr<RecognitionModel> > Graph;
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, RecognitionModelPtr> Graph;
Graph conflict_graph_;

//builds the conflict_graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ template<typename ModelT, typename SceneT>
// initialize model
for (size_t m = 0; m < visible_models_.size (); m++)
{
boost::shared_ptr < RecognitionModel > recog_model (new RecognitionModel);
RecognitionModelPtr recog_model (new RecognitionModel);
// voxelize model cloud
recog_model->cloud_.reset (new pcl::PointCloud<ModelT>);
recog_model->id_ = static_cast<int> (m);
Expand Down
8 changes: 4 additions & 4 deletions recognition/include/pcl/recognition/impl/hv/hv_go.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ void pcl::GlobalHypothesesVerification<ModelT, SceneT>::SAOptimize(std::vector<i
{

//temporal copy of recogniton_models_
std::vector < boost::shared_ptr<RecognitionModel> > recognition_models_copy;
std::vector<RecognitionModelPtr> recognition_models_copy;
recognition_models_copy = recognition_models_;

recognition_models_.clear ();
Expand All @@ -388,7 +388,7 @@ void pcl::GlobalHypothesesVerification<ModelT, SceneT>::SAOptimize(std::vector<i

for (size_t j = 0; j < recognition_models_.size (); j++)
{
boost::shared_ptr < RecognitionModel > recog_model = recognition_models_[j];
RecognitionModelPtr recog_model = recognition_models_[j];
for (size_t i = 0; i < recog_model->explained_.size (); i++)
{
explained_by_RM_[recog_model->explained_[i]]++;
Expand Down Expand Up @@ -487,7 +487,7 @@ void pcl::GlobalHypothesesVerification<ModelT, SceneT>::verify()

template<typename ModelT, typename SceneT>
bool pcl::GlobalHypothesesVerification<ModelT, SceneT>::addModel(typename pcl::PointCloud<ModelT>::ConstPtr & model,
typename pcl::PointCloud<ModelT>::ConstPtr & complete_model, boost::shared_ptr<RecognitionModel> & recog_model)
typename pcl::PointCloud<ModelT>::ConstPtr & complete_model, RecognitionModelPtr & recog_model)
{
//voxelize model cloud
recog_model->cloud_.reset (new pcl::PointCloud<ModelT> ());
Expand Down Expand Up @@ -650,7 +650,7 @@ bool pcl::GlobalHypothesesVerification<ModelT, SceneT>::addModel(typename pcl::P
}

template<typename ModelT, typename SceneT>
void pcl::GlobalHypothesesVerification<ModelT, SceneT>::computeClutterCue(boost::shared_ptr<RecognitionModel> & recog_model)
void pcl::GlobalHypothesesVerification<ModelT, SceneT>::computeClutterCue(RecognitionModelPtr & recog_model)
{
if (detect_clutter_)
{
Expand Down
Loading