diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h index fa3838b40fc..acfd0fec6c0 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h @@ -12,6 +12,8 @@ #include #include +#include + namespace pcl { namespace rec_3d_framework @@ -60,7 +62,7 @@ namespace pcl mls.setUpsamplingStepSize (0.001); } - normals.reset (new pcl::PointCloud); + normals = pcl::make_shared> (); { pcl::ScopeTime t ("Compute normals"); normal_estimator_->estimate (in, processed, normals); @@ -73,7 +75,7 @@ namespace pcl mls.process(*filtered); processed.reset(new pcl::PointCloud); - normals.reset (new pcl::PointCloud); + normals = pcl::make_shared> (); { pcl::ScopeTime t ("Compute normals after MLS"); filtered->is_dense = false; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h index a0f1282e03f..6d29f3267f8 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h @@ -12,6 +12,8 @@ #include #include +#include + namespace pcl { namespace rec_3d_framework @@ -63,7 +65,7 @@ namespace pcl mls.setUpsamplingStepSize (0.001); } - normals.reset (new pcl::PointCloud); + normals = pcl::make_shared> (); { pcl::ScopeTime t ("Compute normals"); normal_estimator_->estimate (in, processed, normals); @@ -77,7 +79,7 @@ namespace pcl mls.process (*filtered); processed.reset (new pcl::PointCloud); - normals.reset (new pcl::PointCloud); + normals = pcl::make_shared> (); { pcl::ScopeTime t ("Compute normals after MLS"); filtered->is_dense = false; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp index b8e205a1e9f..a178d214bb1 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp @@ -7,6 +7,8 @@ #include +#include + #include #include #include @@ -47,7 +49,7 @@ template class Distance, typename PointInT, typename FeatureT> CRHPointCloud::Ptr & hist) { - hist.reset (new CRHPointCloud); + hist = pcl::make_shared (); std::stringstream dir; std::string path = source_->getModelDescriptorDir (model, training_dir_, descr_name_); dir << path << "/crh_" << view_id << "_" << d_id << ".pcd"; @@ -377,7 +379,7 @@ template class Distance, typename PointInT, typename FeatureT> boost::shared_ptr < std::vector > > transforms_temp; models_temp.reset (new std::vector); - transforms_temp.reset (new std::vector >); + transforms_temp = pcl::make_shared >> (); for (size_t i = 0; i < models_->size (); i++) { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp index e8690a35b84..0ae29d17a35 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp @@ -6,9 +6,11 @@ */ #include + +#include #include -#include #include +#include #include template class Distance, typename PointInT, typename FeatureT> @@ -598,7 +600,7 @@ template class Distance, typename PointInT, typename FeatureT> boost::shared_ptr < std::vector > > transforms_temp; models_temp.reset (new std::vector); - transforms_temp.reset (new std::vector >); + transforms_temp = pcl::make_shared >> (); for (size_t i = 0; i < models_->size (); i++) { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp index 29da625766b..a1053fd62eb 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp @@ -1,5 +1,7 @@ #include +#include + #include #include #include @@ -430,7 +432,7 @@ template class Distance, typename PointInT, typename FeatureT> boost::shared_ptr < std::vector > > transforms_temp; models_temp.reset (new std::vector); - transforms_temp.reset (new std::vector >); + transforms_temp = pcl::make_shared >> (); for (size_t i = 0; i < models_->size (); i++) { diff --git a/apps/3d_rec_framework/src/tools/global_classification.cpp b/apps/3d_rec_framework/src/tools/global_classification.cpp index 5bbfa90049b..a0be8e2708c 100644 --- a/apps/3d_rec_framework/src/tools/global_classification.cpp +++ b/apps/3d_rec_framework/src/tools/global_classification.cpp @@ -17,6 +17,8 @@ #include #include +#include + template class DistT, typename PointT, typename FeatureT> void segmentAndClassify (typename pcl::rec_3d_framework::GlobalNNPipeline & global) @@ -164,7 +166,7 @@ main (int argc, char ** argv) cast_source = boost::static_pointer_cast > (mesh_source); boost::shared_ptr > normal_estimator; - normal_estimator.reset (new pcl::rec_3d_framework::PreProcessorAndNormalEstimator); + normal_estimator = pcl::make_shared> (); normal_estimator->setCMR (true); normal_estimator->setDoVoxelGrid (true); normal_estimator->setRemoveOutliers (true); @@ -173,7 +175,7 @@ main (int argc, char ** argv) if (desc_name == "vfh") { boost::shared_ptr > vfh_estimator; - vfh_estimator.reset (new pcl::rec_3d_framework::VFHEstimation); + vfh_estimator = pcl::make_shared> (); vfh_estimator->setNormalEstimator (normal_estimator); boost::shared_ptr > cast_estimator; @@ -193,7 +195,7 @@ main (int argc, char ** argv) if (desc_name == "cvfh") { boost::shared_ptr > vfh_estimator; - vfh_estimator.reset (new pcl::rec_3d_framework::CVFHEstimation); + vfh_estimator = pcl::make_shared> (); vfh_estimator->setNormalEstimator (normal_estimator); boost::shared_ptr > cast_estimator; @@ -213,7 +215,7 @@ main (int argc, char ** argv) if (desc_name == "esf") { boost::shared_ptr > estimator; - estimator.reset (new pcl::rec_3d_framework::ESFEstimation); + estimator = pcl::make_shared> (); boost::shared_ptr > cast_estimator; cast_estimator = boost::dynamic_pointer_cast > (estimator); diff --git a/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp b/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp index cddca4d2704..e336975d8e9 100644 --- a/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp +++ b/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp @@ -23,6 +23,8 @@ #include #include +#include + void getScenesInDirectory (bf::path & dir, std::string & rel_path_so_far, std::vector & relative_paths) { @@ -364,7 +366,7 @@ main (int argc, char ** argv) //configure normal estimator boost::shared_ptr > normal_estimator; - normal_estimator.reset (new pcl::rec_3d_framework::PreProcessorAndNormalEstimator); + normal_estimator = pcl::make_shared> (); normal_estimator->setCMR (false); normal_estimator->setDoVoxelGrid (true); normal_estimator->setRemoveOutliers (true); @@ -434,7 +436,7 @@ main (int argc, char ** argv) if (desc_name == "shot") { boost::shared_ptr > > estimator; - estimator.reset (new pcl::rec_3d_framework::SHOTLocalEstimation >); + estimator = pcl::make_shared >> (); estimator->setNormalEstimator (normal_estimator); estimator->addKeypointExtractor (keypoint_extractor); estimator->setSupportRadius (0.04f); @@ -465,7 +467,7 @@ main (int argc, char ** argv) { desc_name = std::string ("shot"); boost::shared_ptr > > estimator; - estimator.reset (new pcl::rec_3d_framework::SHOTLocalEstimationOMP >); + estimator = pcl::make_shared >> (); estimator->setNormalEstimator (normal_estimator); estimator->addKeypointExtractor (keypoint_extractor); //estimator->setSupportRadius (0.04f); @@ -498,7 +500,7 @@ main (int argc, char ** argv) if (desc_name == "fpfh") { boost::shared_ptr > estimator; - estimator.reset (new pcl::rec_3d_framework::FPFHLocalEstimation); + estimator = pcl::make_shared> (); estimator->setNormalEstimator (normal_estimator); estimator->addKeypointExtractor (keypoint_extractor); estimator->setSupportRadius (0.04f); diff --git a/apps/cloud_composer/src/cloud_view.cpp b/apps/cloud_composer/src/cloud_view.cpp index 844b7555fd7..a6dbdc916ed 100644 --- a/apps/cloud_composer/src/cloud_view.cpp +++ b/apps/cloud_composer/src/cloud_view.cpp @@ -7,12 +7,14 @@ #include +#include + #include pcl::cloud_composer::CloudView::CloudView (QWidget* parent) : QWidget (parent) { - vis_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_ = pcl::make_shared ("", false); vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); //Create the QVTKWidget qvtk_ = new QVTKWidget (this); @@ -28,7 +30,7 @@ pcl::cloud_composer::CloudView::CloudView (ProjectModel* model, QWidget* parent) : QWidget (parent) { model_ = model; - vis_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_ = pcl::make_shared ("", false); // vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); //Create the QVTKWidget qvtk_ = new QVTKWidget (this); diff --git a/apps/cloud_composer/src/items/cloud_item.cpp b/apps/cloud_composer/src/items/cloud_item.cpp index 2aad397deed..282faa42713 100644 --- a/apps/cloud_composer/src/items/cloud_item.cpp +++ b/apps/cloud_composer/src/items/cloud_item.cpp @@ -7,6 +7,8 @@ #include +#include + pcl::cloud_composer::CloudItem::CloudItem (QString name, pcl::PCLPointCloud2::Ptr cloud_ptr, const Eigen::Vector4f& origin, @@ -31,9 +33,9 @@ pcl::cloud_composer::CloudItem::CloudItem (QString name, this->setData (QVariant::fromValue (orientation_), ItemDataRole::ORIENTATION); //Create a color and geometry handler for this cloud - color_handler_.reset (new pcl::visualization::PointCloudColorHandlerRGBField (cloud_ptr)); + color_handler_ = pcl::make_shared> (cloud_ptr); this->setData (QVariant::fromValue (color_handler_), ItemDataRole::COLOR_HANDLER); - geometry_handler_.reset (new pcl::visualization::PointCloudGeometryHandlerXYZ (cloud_ptr)); + geometry_handler_ = pcl::make_shared> (cloud_ptr); this->setData (QVariant::fromValue (geometry_handler_), ItemDataRole::GEOMETRY_HANDLER); properties_->addCategory ("Core Properties"); diff --git a/apps/cloud_composer/src/items/fpfh_item.cpp b/apps/cloud_composer/src/items/fpfh_item.cpp index 4ab7bf1e832..ec117233a56 100644 --- a/apps/cloud_composer/src/items/fpfh_item.cpp +++ b/apps/cloud_composer/src/items/fpfh_item.cpp @@ -3,6 +3,8 @@ #include +#include + #include pcl::cloud_composer::FPFHItem::FPFHItem (QString name, pcl::PointCloud::Ptr fpfh_ptr, double radius) @@ -39,7 +41,7 @@ pcl::cloud_composer::FPFHItem::getInspectorTabs () //Create the plotter and QVTKWidget if it doesn't exist if (!plot_) { - plot_.reset (new pcl::visualization::PCLPlotter); + plot_ = pcl::make_shared (); qvtk_ = new QVTKWidget (); hist_page_ = new QWidget (); QGridLayout *mainLayout = new QGridLayout (hist_page_); diff --git a/apps/in_hand_scanner/src/in_hand_scanner.cpp b/apps/in_hand_scanner/src/in_hand_scanner.cpp index c385c0635e3..8f03002b243 100644 --- a/apps/in_hand_scanner/src/in_hand_scanner.cpp +++ b/apps/in_hand_scanner/src/in_hand_scanner.cpp @@ -46,6 +46,8 @@ #include #include +#include + #include #include #include @@ -292,7 +294,7 @@ pcl::ihs::InHandScanner::newDataCallback (const CloudXYZRGBAConstPtr& cloud_in) CloudXYZRGBNormalPtr cloud_discarded; if (running_mode_ == RM_SHOW_MODEL) { - cloud_data = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); + cloud_data = pcl::make_shared(); } else if (running_mode_ == RM_UNPROCESSED) { @@ -325,7 +327,7 @@ pcl::ihs::InHandScanner::newDataCallback (const CloudXYZRGBAConstPtr& cloud_in) << " - time reconstruct mesh : " << std::setw (8) << std::right << sw.getTime () << " ms\n"; - cloud_data = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); + cloud_data = pcl::make_shared(); ++iteration_; } else @@ -357,7 +359,7 @@ pcl::ihs::InHandScanner::newDataCallback (const CloudXYZRGBAConstPtr& cloud_in) std::cerr << " - time mesh processing : " << std::setw (8) << std::right << sw.getTime () << " ms\n"; - cloud_data = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); + cloud_data = pcl::make_shared(); ++iteration_; } } @@ -470,7 +472,7 @@ pcl::ihs::InHandScanner::startGrabberImpl () try { - grabber_ = GrabberPtr (new Grabber ()); + grabber_ = pcl::make_shared(); } catch (const pcl::PCLException& e) { diff --git a/apps/in_hand_scanner/src/input_data_processing.cpp b/apps/in_hand_scanner/src/input_data_processing.cpp index 1afbb53dff0..f08375c39f8 100644 --- a/apps/in_hand_scanner/src/input_data_processing.cpp +++ b/apps/in_hand_scanner/src/input_data_processing.cpp @@ -44,6 +44,8 @@ #include #include +#include + //////////////////////////////////////////////////////////////////////////////// pcl::ihs::InputDataProcessing::InputDataProcessing () @@ -93,8 +95,8 @@ pcl::ihs::InputDataProcessing::segment (const CloudXYZRGBAConstPtr& cloud_in, return (false); } - if (!cloud_out) cloud_out = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); - if (!cloud_discarded) cloud_discarded = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); + if (!cloud_out) cloud_out = pcl::make_shared(); + if (!cloud_discarded) cloud_discarded = pcl::make_shared(); const unsigned int width = cloud_in->width; const unsigned int height = cloud_in->height; @@ -221,7 +223,7 @@ pcl::ihs::InputDataProcessing::calculateNormals (const CloudXYZRGBAConstPtr& clo } if (!cloud_out) - cloud_out = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); + cloud_out = pcl::make_shared(); // Calculate the normals CloudNormalsPtr cloud_normals (new CloudNormals ()); diff --git a/apps/in_hand_scanner/src/integration.cpp b/apps/in_hand_scanner/src/integration.cpp index 4deff04a7ed..caab2b7c9b5 100644 --- a/apps/in_hand_scanner/src/integration.cpp +++ b/apps/in_hand_scanner/src/integration.cpp @@ -44,6 +44,8 @@ #include #include +#include + #include #include #include @@ -80,7 +82,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d const int width = static_cast (cloud_data->width); const int height = static_cast (cloud_data->height); - if (!mesh_model) mesh_model = MeshPtr (new Mesh ()); + if (!mesh_model) mesh_model = pcl::make_shared(); mesh_model->clear (); mesh_model->reserveVertices (cloud_data->size ()); diff --git a/apps/in_hand_scanner/src/offline_integration.cpp b/apps/in_hand_scanner/src/offline_integration.cpp index 09baa307001..4a8084fa323 100644 --- a/apps/in_hand_scanner/src/offline_integration.cpp +++ b/apps/in_hand_scanner/src/offline_integration.cpp @@ -52,6 +52,8 @@ #include #include +#include + #include #include #include @@ -256,7 +258,7 @@ pcl::ihs::OfflineIntegration::load (const std::string& filename, { if (!cloud) { - cloud = CloudXYZRGBNormalPtr (new CloudXYZRGBNormal ()); + cloud = pcl::make_shared(); } // Load the cloud. diff --git a/apps/in_hand_scanner/src/opengl_viewer.cpp b/apps/in_hand_scanner/src/opengl_viewer.cpp index 3332236ddac..5636925d5cc 100644 --- a/apps/in_hand_scanner/src/opengl_viewer.cpp +++ b/apps/in_hand_scanner/src/opengl_viewer.cpp @@ -57,6 +57,8 @@ #include #include // TODO: PointIHS is not registered + +#include #include //////////////////////////////////////////////////////////////////////////////// @@ -456,9 +458,9 @@ pcl::ihs::OpenGLViewer::addMesh (const MeshConstPtr& mesh, const std::string& id std::lock_guard lock (mutex_vis_); if (this->getMeshIsAdded (id)) - drawn_meshes_ [id] = FaceVertexMeshPtr (new FaceVertexMesh (*mesh, T)); + drawn_meshes_ [id] = pcl::make_shared(*mesh, T); else - drawn_meshes_.insert (std::make_pair (id, FaceVertexMeshPtr (new FaceVertexMesh (*mesh, T)))); + drawn_meshes_.insert (std::make_pair (id, pcl::make_shared(*mesh, T))); return (true); } diff --git a/apps/include/pcl/apps/nn_classification.h b/apps/include/pcl/apps/nn_classification.h index 14812dfd198..e953dd15fe7 100644 --- a/apps/include/pcl/apps/nn_classification.h +++ b/apps/include/pcl/apps/nn_classification.h @@ -45,6 +45,10 @@ #include #include +#include +#include +#include + namespace pcl { /** @@ -78,12 +82,12 @@ namespace pcl /** \brief Setting the training features. * \param[in] features the training features */ - void + void setTrainingFeatures (const typename pcl::PointCloud::ConstPtr &features) { // Do not limit the number of dimensions used in the tree - typename pcl::CustomPointRepresentation::Ptr cpr (new pcl::CustomPointRepresentation (INT_MAX, 0)); - tree_.reset (new pcl::KdTreeFLANN); + typename pcl::CustomPointRepresentation::Ptr cpr = pcl::make_shared> (INT_MAX, 0); + tree_ = pcl::make_shared> (); tree_->setPointRepresentation (cpr); tree_->setInputCloud (features); } @@ -135,7 +139,7 @@ namespace pcl bool loadTrainingFeatures(std::string file_name, std::string labels_file_name) { - typename pcl::PointCloud::Ptr cloud (new pcl::PointCloud); + typename pcl::PointCloud::Ptr cloud = pcl::make_shared> (); if (pcl::io::loadPCDFile (file_name.c_str (), *cloud) != 0) return (false); std::vector labels; @@ -228,7 +232,7 @@ namespace pcl getSmallestSquaredDistances (std::vector &k_indices, std::vector &k_sqr_distances) { // Reserve space for distances - boost::shared_ptr > sqr_distances (new std::vector (classes_.size (), FLT_MAX)); + boost::shared_ptr > sqr_distances = pcl::make_shared> (classes_.size (), FLT_MAX); // Select square distance to each class for (std::vector::const_iterator i = k_indices.begin (); i != k_indices.end (); ++i) @@ -251,7 +255,7 @@ namespace pcl // Transform distances to scores double sum_dist = 0; - boost::shared_ptr, std::vector > > result (new std::pair, std::vector > ()); + boost::shared_ptr, std::vector > > result = pcl::make_shared, std::vector>> (); result->first.reserve (classes_.size ()); result->second.reserve (classes_.size ()); for (std::vector::const_iterator it = sqr_distances->begin (); it != sqr_distances->end (); ++it) @@ -281,7 +285,7 @@ namespace pcl boost::shared_ptr > sqr_distances = getSmallestSquaredDistances (k_indices, k_sqr_distances); // Transform distances to scores - boost::shared_ptr, std::vector > > result (new std::pair, std::vector > ()); + boost::shared_ptr, std::vector > > result = pcl::make_shared, std::vector>> (); result->first.reserve (classes_.size ()); result->second.reserve (classes_.size ()); for (std::vector::const_iterator it = sqr_distances->begin (); it != sqr_distances->end (); ++it) diff --git a/apps/include/pcl/apps/vfh_nn_classifier.h b/apps/include/pcl/apps/vfh_nn_classifier.h index b098d619f65..d01b26cb055 100644 --- a/apps/include/pcl/apps/vfh_nn_classifier.h +++ b/apps/include/pcl/apps/vfh_nn_classifier.h @@ -38,12 +38,14 @@ #pragma once #include -#include -#include -#include -#include -#include + +#include #include +#include +#include +#include +#include +#include namespace pcl { @@ -59,7 +61,7 @@ namespace pcl // Create an empty kdtree representation, and pass it to the objects. // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given). - typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree ()); + typename pcl::search::KdTree::Ptr tree = pcl::make_shared> (); // Create the normal estimation class, and pass the input dataset to it NormalEstimation ne; @@ -67,7 +69,7 @@ namespace pcl ne.setSearchMethod (tree); // Use all neighbors in a sphere of given radius to compute the normals - PointCloud::Ptr normals (new PointCloud ()); + PointCloud::Ptr normals = pcl::make_shared> (); ne.setRadiusSearch (radius); ne.compute (*normals); @@ -78,7 +80,7 @@ namespace pcl vfh.setSearchMethod (tree); // Output datasets - PointCloud::Ptr vfhs (new PointCloud); + PointCloud::Ptr vfhs = pcl::make_shared> (); // Compute the features and return vfh.compute (*vfhs); @@ -117,7 +119,7 @@ namespace pcl void reset () { - training_features_.reset (new FeatureCloud); + training_features_ = pcl::make_shared (); labels_.clear (); classifier_ = NNClassification (); } @@ -191,7 +193,7 @@ namespace pcl */ bool loadTrainingFeatures(std::string file_name, std::string labels_file_name) { - FeatureCloudPtr cloud (new FeatureCloud); + FeatureCloudPtr cloud = pcl::make_shared (); if (pcl::io::loadPCDFile (file_name.c_str (), *cloud) != 0) return false; std::vector labels; @@ -258,7 +260,7 @@ namespace pcl */ FeatureCloudPtr computeFeature (const pcl::PCLPointCloud2 &points, double radius = 0.03) { - pcl::PointCloud::Ptr cloud (new pcl::PointCloud ()); + pcl::PointCloud::Ptr cloud = pcl::make_shared> (); pcl::fromPCLPointCloud2 (points, *cloud); return pcl::computeVFH (cloud, radius); } diff --git a/apps/modeler/src/cloud_mesh.cpp b/apps/modeler/src/cloud_mesh.cpp index b7f8c98dfbc..c7696d62cbe 100755 --- a/apps/modeler/src/cloud_mesh.cpp +++ b/apps/modeler/src/cloud_mesh.cpp @@ -45,12 +45,14 @@ #include #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::CloudMesh::CloudMesh() :vtk_points_(vtkSmartPointer::New()), vtk_polygons_(vtkSmartPointer::New()) { - cloud_.reset(new pcl::PointCloud()); + cloud_ = pcl::make_shared>(); vtk_points_->SetDataTypeToFloat (); } diff --git a/apps/modeler/src/main_window.cpp b/apps/modeler/src/main_window.cpp index 5fb0c1d4884..63680d44553 100755 --- a/apps/modeler/src/main_window.cpp +++ b/apps/modeler/src/main_window.cpp @@ -43,6 +43,8 @@ #include #include + +#include #include #include @@ -204,7 +206,7 @@ pcl::modeler::MainWindow::createRecentPointCloudActions() { for (size_t i = 0; i < MAX_RECENT_NUMBER; ++ i) { - recent_pointcloud_actions_.push_back(boost::shared_ptr(new QAction(this))); + recent_pointcloud_actions_.push_back(pcl::make_shared(this)); ui_->menuRecentPointClouds->addAction(recent_pointcloud_actions_[i].get()); recent_pointcloud_actions_[i]->setVisible(false); connect(recent_pointcloud_actions_[i].get(), SIGNAL(triggered()), this, SLOT(slotOpenRecentPointCloud())); @@ -228,7 +230,7 @@ pcl::modeler::MainWindow::createRecentProjectActions() { for (size_t i = 0; i < MAX_RECENT_NUMBER; ++ i) { - recent_project_actions_.push_back(boost::shared_ptr(new QAction(this))); + recent_project_actions_.push_back(pcl::make_shared(this)); ui_->menuRecentPointClouds->addAction(recent_project_actions_[i].get()); recent_project_actions_[i]->setVisible(false); connect(recent_project_actions_[i].get(), SIGNAL(triggered()), this, SLOT(slotOpenRecentProject())); diff --git a/apps/point_cloud_editor/src/cloudEditorWidget.cpp b/apps/point_cloud_editor/src/cloudEditorWidget.cpp index e87563baddd..d232083360e 100644 --- a/apps/point_cloud_editor/src/cloudEditorWidget.cpp +++ b/apps/point_cloud_editor/src/cloudEditorWidget.cpp @@ -41,6 +41,8 @@ #include #include #include + +#include #include #include @@ -78,7 +80,7 @@ CloudEditorWidget::CloudEditorWidget (QWidget *parent) color_scheme_(COLOR_BY_PURE), is_colored_(false) { setFocusPolicy(Qt::StrongFocus); - command_queue_ptr_ = CommandQueuePtr(new CommandQueue()); + command_queue_ptr_ = pcl::make_shared(); initFileLoadMap(); initKeyMap(); } @@ -185,8 +187,8 @@ CloudEditorWidget::view () { if (!cloud_ptr_) return; - tool_ptr_ = boost::shared_ptr( - new CloudTransformTool(cloud_ptr_)); + tool_ptr_ = pcl::make_shared( + cloud_ptr_); } void @@ -194,8 +196,8 @@ CloudEditorWidget::select1D () { if (!cloud_ptr_) return; - tool_ptr_ = boost::shared_ptr(new Select1DTool(selection_ptr_, - cloud_ptr_)); + tool_ptr_ = pcl::make_shared(selection_ptr_, + cloud_ptr_); update(); } @@ -204,8 +206,8 @@ CloudEditorWidget::select2D () { if (!cloud_ptr_) return; - tool_ptr_ = boost::shared_ptr(new Select2DTool(selection_ptr_, - cloud_ptr_)); + tool_ptr_ = pcl::make_shared(selection_ptr_, + cloud_ptr_); update(); } @@ -294,8 +296,8 @@ CloudEditorWidget::transform () { if (!cloud_ptr_ || !selection_ptr_ || selection_ptr_->empty()) return; - tool_ptr_ = boost::shared_ptr( - new SelectionTransformTool(selection_ptr_, cloud_ptr_, command_queue_ptr_)); + tool_ptr_ = pcl::make_shared( + selection_ptr_, cloud_ptr_, command_queue_ptr_); update(); } @@ -534,17 +536,17 @@ CloudEditorWidget::loadFilePCD(const std::string &filename) Cloud3D tmp; if (pcl::io::loadPCDFile(filename, tmp) == -1) throw; - pcl_cloud_ptr = PclCloudPtr(new Cloud3D(tmp)); + pcl_cloud_ptr = pcl::make_shared(tmp); std::vector index; pcl::removeNaNFromPointCloud(*pcl_cloud_ptr, *pcl_cloud_ptr, index); Statistics::clear(); - cloud_ptr_ = CloudPtr(new Cloud(*pcl_cloud_ptr, true)); - selection_ptr_ = SelectionPtr(new Selection(cloud_ptr_, true)); - copy_buffer_ptr_ = CopyBufferPtr(new CopyBuffer(true)); + cloud_ptr_ = pcl::make_shared(*pcl_cloud_ptr, true); + selection_ptr_ = pcl::make_shared(cloud_ptr_, true); + copy_buffer_ptr_ = pcl::make_shared(true); cloud_ptr_->setPointSize(point_size_); cloud_ptr_->setHighlightPointSize(selected_point_size_); tool_ptr_ = - boost::shared_ptr(new CloudTransformTool(cloud_ptr_)); + pcl::make_shared(cloud_ptr_); if (isColored(filename)) { diff --git a/apps/point_cloud_editor/src/transformCommand.cpp b/apps/point_cloud_editor/src/transformCommand.cpp index 424ad431612..b87110c26de 100644 --- a/apps/point_cloud_editor/src/transformCommand.cpp +++ b/apps/point_cloud_editor/src/transformCommand.cpp @@ -38,9 +38,11 @@ /// @author Yue Li and Matthew Hielsberg #include -#include -#include + +#include #include +#include +#include TransformCommand::TransformCommand(ConstSelectionPtr selection_ptr, CloudPtr cloud_ptr, @@ -52,7 +54,7 @@ TransformCommand::TransformCommand(ConstSelectionPtr selection_ptr, translate_x_(translate_x), translate_y_(translate_y), translate_z_(translate_z) { - internal_selection_ptr_ = SelectionPtr(new Selection(*selection_ptr)); + internal_selection_ptr_ = pcl::make_shared(*selection_ptr); std::copy(matrix, matrix+MATRIX_SIZE, transform_matrix_); const float *cloud_matrix = cloud_ptr_->getMatrix(); std::copy(cloud_matrix, cloud_matrix+MATRIX_SIZE, cloud_matrix_); diff --git a/apps/src/grabcut_2d.cpp b/apps/src/grabcut_2d.cpp index 30f866a42b7..3e5ec053606 100644 --- a/apps/src/grabcut_2d.cpp +++ b/apps/src/grabcut_2d.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -12,6 +13,7 @@ #include #if defined (FREEGLUT) #include + #elif defined (GLUI_OPENGLUT) #include #endif @@ -81,10 +83,10 @@ GrabCutHelper::setInputCloud (const pcl::PointCloud::ConstPtr& { pcl::GrabCut::setInputCloud (cloud); // Reset clouds - n_links_image_.reset (new pcl::PointCloud (cloud->width, cloud->height, 0)); - t_links_image_.reset (new pcl::segmentation::grabcut::Image (cloud->width, cloud->height)); - gmm_image_.reset (new pcl::segmentation::grabcut::Image (cloud->width, cloud->height)); - alpha_image_.reset (new pcl::PointCloud (cloud->width, cloud->height, 0)); + n_links_image_ = pcl::make_shared> (cloud->width, cloud->height, 0); + t_links_image_ = pcl::make_shared (cloud->width, cloud->height); + gmm_image_ = pcl::make_shared (cloud->width, cloud->height); + alpha_image_ = pcl::make_shared> (cloud->width, cloud->height, 0); image_height_1_ = cloud->height-1; image_width_1_ = cloud->width-1; } @@ -507,7 +509,7 @@ int main (int argc, char** argv) display_type = -1; - display_image.reset (new pcl::segmentation::grabcut::Image (scene->width, scene->height)); + display_image = pcl::make_shared (scene->width, scene->height); pcl::PointCloud::Ptr tmp (new pcl::PointCloud (scene->width, scene->height)); if (scene->isOrganized ()) diff --git a/apps/src/manual_registration/manual_registration.cpp b/apps/src/manual_registration/manual_registration.cpp index 899e597c29b..f046b0a8f47 100644 --- a/apps/src/manual_registration/manual_registration.cpp +++ b/apps/src/manual_registration/manual_registration.cpp @@ -46,6 +46,8 @@ #include #include +#include + // VTK #include #include @@ -69,7 +71,7 @@ ManualRegistration::ManualRegistration () this->setWindowTitle ("PCL Manual Registration"); // Set up the source window - vis_src_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_src_ = pcl::make_shared ("", false); ui_->qvtk_widget_src->SetRenderWindow (vis_src_->getRenderWindow ()); vis_src_->setupInteractor (ui_->qvtk_widget_src->GetInteractor (), ui_->qvtk_widget_src->GetRenderWindow ()); vis_src_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); @@ -78,7 +80,7 @@ ManualRegistration::ManualRegistration () vis_src_->registerPointPickingCallback (&ManualRegistration::SourcePointPickCallback, *this); // Set up the destination window - vis_dst_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_dst_ = pcl::make_shared ("", false); ui_->qvtk_widget_dst->SetRenderWindow (vis_dst_->getRenderWindow ()); vis_dst_->setupInteractor (ui_->qvtk_widget_dst->GetInteractor (), ui_->qvtk_widget_dst->GetRenderWindow ()); vis_dst_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); diff --git a/apps/src/multiscale_feature_persistence_example.cpp b/apps/src/multiscale_feature_persistence_example.cpp index 49f6a7457c8..92d64d8ba82 100644 --- a/apps/src/multiscale_feature_persistence_example.cpp +++ b/apps/src/multiscale_feature_persistence_example.cpp @@ -32,7 +32,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * */ #include @@ -41,9 +41,11 @@ #include #include #include +#include #include + using namespace pcl; const Eigen::Vector4f subsampling_leaf_size (0.01f, 0.01f, 0.01f, 0.0f); @@ -55,16 +57,16 @@ subsampleAndCalculateNormals (PointCloud::Ptr &cloud, PointCloud::Ptr &cloud_subsampled, PointCloud::Ptr &cloud_subsampled_normals) { - cloud_subsampled = PointCloud::Ptr (new PointCloud ()); + cloud_subsampled = pcl::make_shared> (); VoxelGrid subsampling_filter; subsampling_filter.setInputCloud (cloud); subsampling_filter.setLeafSize (subsampling_leaf_size); subsampling_filter.filter (*cloud_subsampled); - cloud_subsampled_normals = PointCloud::Ptr (new PointCloud ()); + cloud_subsampled_normals = pcl::make_shared> (); NormalEstimation normal_estimation_filter; normal_estimation_filter.setInputCloud (cloud_subsampled); - pcl::search::KdTree::Ptr search_tree (new pcl::search::KdTree); + pcl::search::KdTree::Ptr search_tree = pcl::make_shared> (); normal_estimation_filter.setSearchMethod (search_tree); normal_estimation_filter.setRadiusSearch (normal_estimation_search_radius); normal_estimation_filter.compute (*cloud_subsampled_normals); @@ -80,7 +82,7 @@ main (int argc, char **argv) return -1; } - PointCloud::Ptr cloud_scene (new PointCloud ()); + PointCloud::Ptr cloud_scene = pcl::make_shared> (); PCDReader reader; reader.read (argv[1], *cloud_scene); @@ -99,16 +101,16 @@ main (int argc, char **argv) scale_values.push_back (x / 100.0f); feature_persistence.setScalesVector (scale_values); feature_persistence.setAlpha (1.3f); - FPFHEstimation::Ptr fpfh_estimation (new FPFHEstimation ()); + FPFHEstimation::Ptr fpfh_estimation = pcl::make_shared> (); fpfh_estimation->setInputCloud (cloud_subsampled); fpfh_estimation->setInputNormals (cloud_subsampled_normals); - pcl::search::KdTree::Ptr tree (new pcl::search::KdTree ()); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); fpfh_estimation->setSearchMethod (tree); feature_persistence.setFeatureEstimator (fpfh_estimation); feature_persistence.setDistanceMetric (pcl::CS); - PointCloud::Ptr output_features (new PointCloud ()); - boost::shared_ptr > output_indices (new std::vector ()); + PointCloud::Ptr output_features = pcl::make_shared> (); + boost::shared_ptr > output_indices = pcl::make_shared> (); feature_persistence.determinePersistentFeatures (*output_features, output_indices); PCL_INFO ("persistent features cloud size: %u\n", output_features->points.size ()); @@ -116,7 +118,7 @@ main (int argc, char **argv) ExtractIndices extract_indices_filter; extract_indices_filter.setInputCloud (cloud_subsampled); extract_indices_filter.setIndices (output_indices); - PointCloud::Ptr persistent_features_locations (new PointCloud ()); + PointCloud::Ptr persistent_features_locations = pcl::make_shared> (); extract_indices_filter.filter (*persistent_features_locations); viewer.showCloud (persistent_features_locations, "persistent features"); diff --git a/apps/src/ni_brisk.cpp b/apps/src/ni_brisk.cpp index b76563fe4d1..4c4eb7fccee 100644 --- a/apps/src/ni_brisk.cpp +++ b/apps/src/ni_brisk.cpp @@ -55,6 +55,8 @@ #include #include +#include + using namespace pcl; using namespace std; using namespace std::chrono_literals; @@ -91,7 +93,7 @@ class BRISKDemo brisk.setOctaves (4); brisk.setInputCloud (cloud); - keypoints_.reset (new PointCloud); + keypoints_ = pcl::make_shared> (); brisk.compute (*keypoints_); } diff --git a/apps/src/ni_linemod.cpp b/apps/src/ni_linemod.cpp index 7f69d879ebb..5435dbccda5 100644 --- a/apps/src/ni_linemod.cpp +++ b/apps/src/ni_linemod.cpp @@ -64,6 +64,8 @@ #include #include +#include + using namespace pcl; using namespace std; using namespace std::chrono_literals; @@ -95,7 +97,7 @@ class NILinemod ne_.setNormalSmoothingSize (20.0f); // Set the parameters for planar segmentation - plane_comparator_.reset (new EdgeAwarePlaneComparator); + plane_comparator_ = pcl::make_shared> (); plane_comparator_->setDistanceThreshold (0.01f, false); mps_.setMinInliers (5000); mps_.setAngularThreshold (pcl::deg2rad (3.0)); // 3 degrees @@ -156,7 +158,7 @@ class NILinemod } else { - plane_.reset (new Cloud); + plane_ = pcl::make_shared (); // Compute the convex hull of the plane ConvexHull chull; @@ -343,14 +345,14 @@ class NILinemod if (idx != -1) { region = regions[idx]; - plane_indices_.reset (new PointIndices (inlier_indices[idx])); - plane_boundary_indices.reset (new PointIndices (boundary_indices[idx])); + plane_indices_ = pcl::make_shared (inlier_indices[idx]); + plane_boundary_indices = pcl::make_shared (boundary_indices[idx]); } // Segment the object of interest if (plane_boundary_indices && !plane_boundary_indices->indices.empty ()) { - object.reset (new Cloud); + object = pcl::make_shared (); segmentObject (picked_idx, search_.getInputCloud (), plane_indices_, plane_boundary_indices, *object); // Save to disk diff --git a/apps/src/ni_susan.cpp b/apps/src/ni_susan.cpp index 8d93b8a6942..fd5b284d479 100644 --- a/apps/src/ni_susan.cpp +++ b/apps/src/ni_susan.cpp @@ -54,6 +54,8 @@ #include #include +#include + using namespace pcl; using namespace std; using namespace std::chrono_literals; @@ -89,7 +91,7 @@ class SUSANDemo susan.setInputCloud (cloud); susan.setNumberOfThreads (6); susan.setNonMaxSupression (true); - keypoints_.reset (new PointCloud); + keypoints_ = pcl::make_shared> (); susan.compute (*keypoints_); } diff --git a/apps/src/ni_trajkovic.cpp b/apps/src/ni_trajkovic.cpp index fb1f1899921..93607c36b94 100644 --- a/apps/src/ni_trajkovic.cpp +++ b/apps/src/ni_trajkovic.cpp @@ -52,6 +52,8 @@ #include #include +#include + using namespace std::chrono_literals; using namespace pcl; using PointT = PointXYZRGBA; @@ -85,7 +87,7 @@ class TrajkovicDemo TrajkovicKeypoint3D trajkovic; trajkovic.setInputCloud (cloud); trajkovic.setNumberOfThreads (6); - keypoints_.reset (new PointCloud); + keypoints_ = pcl::make_shared> (); trajkovic.compute (*keypoints_); keypoints_indices_ = trajkovic.getKeypointsIndices (); } @@ -102,7 +104,7 @@ class TrajkovicDemo TrajkovicKeypoint2D trajkovic; trajkovic.setInputCloud (cloud); trajkovic.setNumberOfThreads (6); - keypoints_.reset (new PointCloud); + keypoints_ = pcl::make_shared> (); trajkovic.compute (*keypoints_); keypoints_indices_ = trajkovic.getKeypointsIndices (); } diff --git a/apps/src/openni_boundary_estimation.cpp b/apps/src/openni_boundary_estimation.cpp index ddd44b4a976..9889734cb22 100644 --- a/apps/src/openni_boundary_estimation.cpp +++ b/apps/src/openni_boundary_estimation.cpp @@ -50,6 +50,8 @@ #include #include +#include + using namespace std::chrono_literals; using ColorHandler = pcl::visualization::PointCloudColorHandler; @@ -102,7 +104,7 @@ class OpenNIIntegralImageNormalEstimation //lock while we set our cloud; FPS_CALC ("computation"); - cloud_.reset (new pcl::PointCloud); + cloud_ = pcl::make_shared> (); // Estimate surface normals ne_.setInputCloud (cloud); @@ -116,7 +118,7 @@ class OpenNIIntegralImageNormalEstimation be_.setInputCloud (cloud_); be_.setInputNormals (cloud_); - boundaries_.reset (new pcl::PointCloud); + boundaries_ = pcl::make_shared> (); be_.compute (*boundaries_); new_cloud_ = true; diff --git a/apps/src/openni_change_viewer.cpp b/apps/src/openni_change_viewer.cpp index 352ea4e9c91..8208a082b21 100644 --- a/apps/src/openni_change_viewer.cpp +++ b/apps/src/openni_change_viewer.cpp @@ -36,6 +36,8 @@ #include +#include + #include #include #include @@ -90,7 +92,7 @@ class OpenNIChangeViewer switch (mode_) { case REDDIFF_MODE: - filtered_cloud.reset (new pcl::PointCloud (*cloud)); + filtered_cloud = pcl::make_shared> (*cloud); filtered_cloud->points.reserve(newPointIdxVector.size()); for (const int &idx : newPointIdxVector) @@ -101,7 +103,7 @@ class OpenNIChangeViewer break; case ONLYDIFF_MODE: - filtered_cloud.reset (new pcl::PointCloud); + filtered_cloud = pcl::make_shared> (); filtered_cloud->points.reserve(newPointIdxVector.size()); diff --git a/apps/src/openni_mobile_server.cpp b/apps/src/openni_mobile_server.cpp index d8f521ce17c..416198e71aa 100644 --- a/apps/src/openni_mobile_server.cpp +++ b/apps/src/openni_mobile_server.cpp @@ -46,6 +46,8 @@ #include #include +#include + using boost::asio::ip::tcp; using namespace std::chrono_literals; @@ -130,7 +132,7 @@ class PCLMobileServer voxel_grid_filter_.setInputCloud (new_cloud); voxel_grid_filter_.filter (*temp_cloud); - PointCloudBuffers::Ptr new_buffers = PointCloudBuffers::Ptr (new PointCloudBuffers); + PointCloudBuffers::Ptr new_buffers = pcl::make_shared(); CopyPointCloudToBuffers (temp_cloud, *new_buffers); std::lock_guard lock (mutex_); diff --git a/apps/src/openni_passthrough.cpp b/apps/src/openni_passthrough.cpp index ba59fce3e85..803fe943ca6 100644 --- a/apps/src/openni_passthrough.cpp +++ b/apps/src/openni_passthrough.cpp @@ -43,6 +43,8 @@ #include #include #include + +#include // PCL #include @@ -64,7 +66,7 @@ OpenNIPassthrough::OpenNIPassthrough (pcl::OpenNIGrabber& grabber) ui_->setupUi (this); this->setWindowTitle ("PCL OpenNI PassThrough Viewer"); - vis_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_ = pcl::make_shared ("", false); ui_->qvtk_widget->SetRenderWindow (vis_->getRenderWindow ()); vis_->setupInteractor (ui_->qvtk_widget->GetInteractor (), ui_->qvtk_widget->GetRenderWindow ()); vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); @@ -93,7 +95,7 @@ OpenNIPassthrough::cloud_cb (const CloudConstPtr& cloud) FPS_CALC ("computation"); // Computation goes here - cloud_pass_.reset (new Cloud); + cloud_pass_ = pcl::make_shared (); pass_.setInputCloud (cloud); pass_.filter (*cloud_pass_); } diff --git a/apps/src/openni_shift_to_depth_conversion.cpp b/apps/src/openni_shift_to_depth_conversion.cpp index c871dc38871..c2a30dabd84 100644 --- a/apps/src/openni_shift_to_depth_conversion.cpp +++ b/apps/src/openni_shift_to_depth_conversion.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,7 @@ #include + using boost::asio::ip::tcp; using namespace pcl; @@ -106,7 +108,7 @@ class SimpleOpenNIViewer } // empty pointcloud - pcl::PointCloud::Ptr cloud = pcl::PointCloud::Ptr(new pcl::PointCloud()); + pcl::PointCloud::Ptr cloud = pcl::make_shared>(); // convert raw depth and rgb data to pointcloud convert (raw_depth_data, diff --git a/apps/src/openni_uniform_sampling.cpp b/apps/src/openni_uniform_sampling.cpp index 9e9bdbab5a8..df4232b9bfc 100644 --- a/apps/src/openni_uniform_sampling.cpp +++ b/apps/src/openni_uniform_sampling.cpp @@ -45,6 +45,8 @@ #include #include +#include + using namespace std::chrono_literals; #define FPS_CALC(_WHAT_) \ @@ -84,8 +86,8 @@ class OpenNIUniformSampling std::lock_guard lock (mtx_); FPS_CALC ("computation"); - cloud_.reset (new Cloud); - keypoints_.reset (new pcl::PointCloud); + cloud_ = pcl::make_shared (); + keypoints_ = pcl::make_shared> (); // Computation goes here pass_.setInputCloud (cloud); pcl::PointCloud sampled; diff --git a/apps/src/organized_segmentation_demo.cpp b/apps/src/organized_segmentation_demo.cpp index 789f1218bbc..ed0831ac3a3 100644 --- a/apps/src/organized_segmentation_demo.cpp +++ b/apps/src/organized_segmentation_demo.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include #include @@ -205,7 +207,7 @@ OrganizedSegmentationDemo::OrganizedSegmentationDemo (pcl::Grabber& grabber) : g ui_->setupUi (this); this->setWindowTitle ("PCL Organized Connected Component Segmentation Demo"); - vis_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_ = pcl::make_shared ("", false); ui_->qvtk_widget->SetRenderWindow (vis_->getRenderWindow ()); vis_->setupInteractor (ui_->qvtk_widget->GetInteractor (), ui_->qvtk_widget->GetRenderWindow ()); vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); @@ -250,10 +252,10 @@ OrganizedSegmentationDemo::OrganizedSegmentationDemo (pcl::Grabber& grabber) : g ne.setMaxDepthChangeFactor (0.02f); // set as default, well performing for tabletop objects as imaged by a primesense sensor ne.setNormalSmoothingSize (20.0f); - plane_comparator_.reset (new pcl::PlaneCoefficientComparator ()); - euclidean_comparator_.reset (new pcl::EuclideanPlaneCoefficientComparator ()); - rgb_comparator_.reset (new pcl::RGBPlaneCoefficientComparator ()); - edge_aware_comparator_.reset (new pcl::EdgeAwarePlaneComparator ()); + plane_comparator_ = pcl::make_shared> (); + euclidean_comparator_ = pcl::make_shared> (); + rgb_comparator_ = pcl::make_shared> (); + edge_aware_comparator_ = pcl::make_shared> (); euclidean_cluster_comparator_ = pcl::EuclideanClusterComparator::Ptr (new pcl::EuclideanClusterComparator ()); // Set up Organized Multi Plane Segmentation diff --git a/apps/src/pcd_video_player/pcd_video_player.cpp b/apps/src/pcd_video_player/pcd_video_player.cpp index 526f3769c5f..7c0b4e33b88 100644 --- a/apps/src/pcd_video_player/pcd_video_player.cpp +++ b/apps/src/pcd_video_player/pcd_video_player.cpp @@ -60,6 +60,8 @@ #include #include +#include + // VTK #include #include @@ -89,10 +91,10 @@ PCDVideoPlayer::PCDVideoPlayer () this->setWindowTitle ("PCL PCD Video Player"); // Setup the cloud pointer - cloud_.reset (new pcl::PointCloud); + cloud_ = pcl::make_shared> (); // Set up the qvtk window - vis_.reset (new pcl::visualization::PCLVisualizer ("", false)); + vis_ = pcl::make_shared ("", false); ui_->qvtkWidget->SetRenderWindow (vis_->getRenderWindow ()); vis_->setupInteractor (ui_->qvtkWidget->GetInteractor (), ui_->qvtkWidget->GetRenderWindow ()); vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT); diff --git a/apps/src/pyramid_surface_matching.cpp b/apps/src/pyramid_surface_matching.cpp index 2396a1cb0be..b875eee76ea 100644 --- a/apps/src/pyramid_surface_matching.cpp +++ b/apps/src/pyramid_surface_matching.cpp @@ -7,6 +7,8 @@ using namespace pcl; #include + +#include using namespace std; const Eigen::Vector4f subsampling_leaf_size (0.02f, 0.02f, 0.02f, 0.0f); @@ -20,16 +22,16 @@ subsampleAndCalculateNormals (PointCloud::Ptr &cloud, PointCloud::Ptr &cloud_subsampled, PointCloud::Ptr &cloud_subsampled_normals) { - cloud_subsampled = PointCloud::Ptr (new PointCloud ()); + cloud_subsampled = pcl::make_shared> (); VoxelGrid subsampling_filter; subsampling_filter.setInputCloud (cloud); subsampling_filter.setLeafSize (subsampling_leaf_size); subsampling_filter.filter (*cloud_subsampled); - cloud_subsampled_normals = PointCloud::Ptr (new PointCloud ()); + cloud_subsampled_normals = pcl::make_shared> (); NormalEstimation normal_estimation_filter; normal_estimation_filter.setInputCloud (cloud_subsampled); - search::KdTree::Ptr search_tree (new search::KdTree); + search::KdTree::Ptr search_tree = pcl::make_shared> (); normal_estimation_filter.setSearchMethod (search_tree); normal_estimation_filter.setRadiusSearch (normal_estimation_search_radius); normal_estimation_filter.compute (*cloud_subsampled_normals); @@ -50,8 +52,8 @@ main (int argc, char **argv) /// read point clouds from HDD PCL_INFO ("Reading scene ...\n"); - PointCloud::Ptr cloud_a (new PointCloud ()), - cloud_b (new PointCloud ()); + PointCloud::Ptr cloud_a = pcl::make_shared> (), + cloud_b = pcl::make_shared> (); PCDReader reader; reader.read (argv[1], *cloud_a); reader.read (argv[2], *cloud_b); @@ -64,10 +66,10 @@ main (int argc, char **argv) PCL_INFO ("Finished subsampling the clouds ...\n"); - PointCloud::Ptr ppf_signature_a (new PointCloud ()), - ppf_signature_b (new PointCloud ()); - PointCloud::Ptr cloud_subsampled_with_normals_a (new PointCloud ()), - cloud_subsampled_with_normals_b (new PointCloud ()); + PointCloud::Ptr ppf_signature_a = pcl::make_shared> (), + ppf_signature_b = pcl::make_shared> (); + PointCloud::Ptr cloud_subsampled_with_normals_a = pcl::make_shared> (), + cloud_subsampled_with_normals_b = pcl::make_shared> (); concatenateFields (*cloud_a_subsampled, *cloud_a_subsampled_normals, *cloud_subsampled_with_normals_a); concatenateFields (*cloud_b_subsampled, *cloud_b_subsampled_normals, *cloud_subsampled_with_normals_b); @@ -89,14 +91,14 @@ main (int argc, char **argv) dim_range_target.emplace_back(0.0f, 50.0f); - PyramidFeatureHistogram::Ptr pyramid_a (new PyramidFeatureHistogram ()); + PyramidFeatureHistogram::Ptr pyramid_a = pcl::make_shared> (); pyramid_a->setInputCloud (ppf_signature_a); pyramid_a->setInputDimensionRange (dim_range_input); pyramid_a->setTargetDimensionRange (dim_range_target); pyramid_a->compute (); PCL_INFO ("Done with the first pyramid\n"); - PyramidFeatureHistogram::Ptr pyramid_b (new PyramidFeatureHistogram ()); + PyramidFeatureHistogram::Ptr pyramid_b = pcl::make_shared> (); pyramid_b->setInputCloud (ppf_signature_b); pyramid_b->setInputDimensionRange (dim_range_input); pyramid_b->setTargetDimensionRange (dim_range_target); diff --git a/common/include/pcl/range_image/range_image.h b/common/include/pcl/range_image/range_image.h index 13c60a4d4d7..6bf6fef4ac6 100644 --- a/common/include/pcl/range_image/range_image.h +++ b/common/include/pcl/range_image/range_image.h @@ -37,6 +37,7 @@ #pragma once +#include #include #include #include @@ -121,7 +122,7 @@ namespace pcl // =====METHODS===== /** \brief Get a boost shared pointer of a copy of this */ inline Ptr - makeShared () { return Ptr (new RangeImage (*this)); } + makeShared () { return pcl::make_shared(*this); } /** \brief Reset all values to an empty range image */ PCL_EXPORTS void diff --git a/common/include/pcl/range_image/range_image_planar.h b/common/include/pcl/range_image/range_image_planar.h index 7db0583cdaf..de2014968cc 100644 --- a/common/include/pcl/range_image/range_image_planar.h +++ b/common/include/pcl/range_image/range_image_planar.h @@ -74,7 +74,7 @@ namespace pcl // =====PUBLIC METHODS===== /** \brief Get a boost shared pointer of a copy of this */ inline Ptr - makeShared () { return Ptr (new RangeImagePlanar (*this)); } + makeShared () { return pcl::make_shared(*this); } /** \brief Create the image from an existing disparity image. * \param disparity_image the input disparity image data @@ -214,3 +214,5 @@ namespace pcl #include // Definitions of templated and inline functions + +#include diff --git a/common/src/pcl_base.cpp b/common/src/pcl_base.cpp index aacbeaaf242..3b3a43df0d7 100644 --- a/common/src/pcl_base.cpp +++ b/common/src/pcl_base.cpp @@ -38,6 +38,8 @@ #include +#include + /////////////////////////////////////////////////////////////////////////////////////////// pcl::PCLBase::PCLBase () : use_indices_ (false) @@ -133,7 +135,7 @@ pcl::PCLBase::initCompute () if (!indices_) { fake_indices_ = true; - indices_.reset (new std::vector); + indices_ = pcl::make_shared> (); try { indices_->resize (input_->width * input_->height); @@ -168,13 +170,14 @@ pcl::PCLBase::setIndices (const IndicesPtr &indices) void pcl::PCLBase::setIndices (const PointIndicesConstPtr &indices) { - indices_.reset (new std::vector (indices->indices)); + indices_ = pcl::make_shared> (indices->indices); fake_indices_ = false; use_indices_ = true; } #ifndef PCL_NO_PRECOMPILE #include + #include PCL_INSTANTIATE(PCLBase, PCL_POINT_TYPES) #endif // PCL_NO_PRECOMPILE diff --git a/examples/common/example_get_max_min_coordinates.cpp b/examples/common/example_get_max_min_coordinates.cpp index 06d7e43ffce..583035c6e33 100644 --- a/examples/common/example_get_max_min_coordinates.cpp +++ b/examples/common/example_get_max_min_coordinates.cpp @@ -1,13 +1,14 @@ #include + +#include +#include #include #include -#include -int +int main (int, char**) { - pcl::PointCloud::Ptr cloud; - cloud = pcl::PointCloud::Ptr (new pcl::PointCloud); + pcl::PointCloud::Ptr cloud = pcl::make_shared> (); pcl::io::loadPCDFile ("your_pcd_file.pcd", *cloud); pcl::PointXYZ minPt, maxPt; pcl::getMinMax3D (*cloud, minPt, maxPt); diff --git a/examples/features/example_difference_of_normals.cpp b/examples/features/example_difference_of_normals.cpp index f39bb7cea42..f57e84de08f 100644 --- a/examples/features/example_difference_of_normals.cpp +++ b/examples/features/example_difference_of_normals.cpp @@ -7,6 +7,8 @@ */ #include +#include + #include #include #include @@ -68,7 +70,7 @@ int main (int argc, char *argv[]) pcl::PCLPointCloud2 blob; pcl::io::loadPCDFile (infile.c_str(), blob); - pcl::PointCloud::Ptr cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr cloud = pcl::make_shared> (); cout << "Loading point cloud..."; pcl::fromPCLPointCloud2 (blob, *cloud); cout << "done." << endl; @@ -77,11 +79,11 @@ int main (int argc, char *argv[]) if (cloud->isOrganized ()) { - tree.reset (new pcl::search::OrganizedNeighbor ()); + tree = pcl::make_shared> (); } else { - tree.reset (new pcl::search::KdTree (false)); + tree = pcl::make_shared> (false); } tree->setInputCloud (cloud); @@ -99,14 +101,14 @@ int main (int argc, char *argv[]) sor.setInputCloud (cloud); // Create downsampled point cloud for DoN NN search with small scale - small_cloud_downsampled = PointCloud::Ptr(new pcl::PointCloud); + small_cloud_downsampled = pcl::make_shared> (); float smalldownsample = static_cast (scale1 / decimation); sor.setLeafSize (smalldownsample, smalldownsample, smalldownsample); sor.filter (*small_cloud_downsampled); cout << "Using leaf size of " << smalldownsample << " for small scale, " << small_cloud_downsampled->size() << " points" << endl; // Create downsampled point cloud for DoN NN search with large scale - large_cloud_downsampled = PointCloud::Ptr(new pcl::PointCloud); + large_cloud_downsampled = pcl::make_shared> (); const float largedownsample = float (scale2/decimation); sor.setLeafSize (largedownsample, largedownsample, largedownsample); sor.filter (*large_cloud_downsampled); @@ -131,7 +133,7 @@ int main (int argc, char *argv[]) //the normals calculated with the small scale cout << "Calculating normals for scale..." << scale1 << endl; - pcl::PointCloud::Ptr normals_small_scale (new pcl::PointCloud); + pcl::PointCloud::Ptr normals_small_scale = pcl::make_shared> (); if(approx){ ne.setSearchSurface(small_cloud_downsampled); @@ -142,7 +144,7 @@ int main (int argc, char *argv[]) cout << "Calculating normals for scale..." << scale2 << endl; //the normals calculated with the large scale - pcl::PointCloud::Ptr normals_large_scale (new pcl::PointCloud); + pcl::PointCloud::Ptr normals_large_scale = pcl::make_shared> (); if(approx){ ne.setSearchSurface(large_cloud_downsampled); @@ -151,7 +153,7 @@ int main (int argc, char *argv[]) ne.compute (*normals_large_scale); // Create output cloud for DoN results - PointCloud::Ptr doncloud (new pcl::PointCloud); + PointCloud::Ptr doncloud = pcl::make_shared> (); copyPointCloud(*cloud, *doncloud); cout << "Calculating DoN... " << endl; @@ -178,16 +180,14 @@ int main (int argc, char *argv[]) cout << "Filtering out DoN mag <= "<< threshold << "..." << endl; // build the condition - pcl::ConditionOr::Ptr range_cond (new - pcl::ConditionOr ()); - range_cond->addComparison (pcl::FieldComparison::ConstPtr (new - pcl::FieldComparison ("curvature", pcl::ComparisonOps::GT, threshold))); + pcl::ConditionOr::Ptr range_cond = pcl::make_shared> (); + range_cond->addComparison (pcl::make_shared> ("curvature", pcl::ComparisonOps::GT, threshold)); // build the filter pcl::ConditionalRemoval condrem; condrem.setCondition (range_cond); condrem.setInputCloud (doncloud); - pcl::PointCloud::Ptr doncloud_filtered (new pcl::PointCloud); + pcl::PointCloud::Ptr doncloud_filtered = pcl::make_shared> (); // apply filter condrem.filter (*doncloud_filtered); @@ -203,7 +203,7 @@ int main (int argc, char *argv[]) //Filter by magnitude cout << "Clustering using EuclideanClusterExtraction with tolerance <= "<< segradius << "..." << endl; - pcl::search::KdTree::Ptr segtree (new pcl::search::KdTree); + pcl::search::KdTree::Ptr segtree = pcl::make_shared> (); segtree->setInputCloud (doncloud); std::vector cluster_indices; @@ -219,7 +219,7 @@ int main (int argc, char *argv[]) int j = 0; for (std::vector::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it, j++) { - pcl::PointCloud::Ptr cloud_cluster_don (new pcl::PointCloud); + pcl::PointCloud::Ptr cloud_cluster_don = pcl::make_shared> (); for (const int &index : it->indices){ cloud_cluster_don->points.push_back (doncloud->points[index]); } diff --git a/filters/src/project_inliers.cpp b/filters/src/project_inliers.cpp index 9fc49680019..c7e1c8231ea 100644 --- a/filters/src/project_inliers.cpp +++ b/filters/src/project_inliers.cpp @@ -39,6 +39,7 @@ */ #include +#include /////////////////////////////////////////////////////////////////////////////////////////// void @@ -169,73 +170,73 @@ pcl::ProjectInliers::initSACModel (int model_type) case SACMODEL_PLANE: { //PCL_DEBUG ("[pcl::%s::initSACModel] Using a model of type: SACMODEL_PLANE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelPlane (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_LINE: { //PCL_DEBUG ("[pcl::%s::initSACModel] Using a model of type: SACMODEL_LINE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelLine (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_CIRCLE2D: { //PCL_DEBUG ("[pcl::%s::initSACModel] Using a model of type: SACMODEL_CIRCLE2D\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelCircle2D (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_SPHERE: { //PCL_DEBUG ("[pcl::%s::initSACModel] Using a model of type: SACMODEL_SPHERE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelSphere (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_PARALLEL_LINE: { //PCL_DEBUG ("[pcl::%s::initSACModel] Using a model of type: SACMODEL_PARALLEL_LINE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelParallelLine (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_PERPENDICULAR_PLANE: { //PCL_DEBUG ("[pcl::%s::initSACModel] Using a model of type: SACMODEL_PERPENDICULAR_PLANE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelPerpendicularPlane (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_CYLINDER: { //PCL_DEBUG ("[pcl::%s::segment] Using a model of type: SACMODEL_CYLINDER\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelCylinder (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_NORMAL_PLANE: { //PCL_DEBUG ("[pcl::%s::segment] Using a model of type: SACMODEL_NORMAL_PLANE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelNormalPlane (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_CONE: { //PCL_DEBUG ("[pcl::%s::segment] Using a model of type: SACMODEL_CONE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelCone (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_NORMAL_SPHERE: { //PCL_DEBUG ("[pcl::%s::segment] Using a model of type: SACMODEL_NORMAL_SPHERE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelNormalSphere (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_NORMAL_PARALLEL_PLANE: { //PCL_DEBUG ("[pcl::%s::segment] Using a model of type: SACMODEL_NORMAL_PARALLEL_PLANE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelNormalParallelPlane (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } case SACMODEL_PARALLEL_PLANE: { //PCL_DEBUG ("[pcl::%s::segment] Using a model of type: SACMODEL_PARALLEL_PLANE\n", getClassName ().c_str ()); - sacmodel_.reset (new SampleConsensusModelParallelPlane (cloud_ptr)); + sacmodel_ = pcl::make_shared> (cloud_ptr); break; } default: @@ -249,6 +250,7 @@ pcl::ProjectInliers::initSACModel (int model_type) #ifndef PCL_NO_PRECOMPILE #include + #include // Instantiations of specific point types diff --git a/filters/src/radius_outlier_removal.cpp b/filters/src/radius_outlier_removal.cpp index aea4199ef0b..95f755f1b76 100644 --- a/filters/src/radius_outlier_removal.cpp +++ b/filters/src/radius_outlier_removal.cpp @@ -40,6 +40,7 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////////////////// void @@ -63,16 +64,16 @@ pcl::RadiusOutlierRemoval::applyFilter (PCLPointCloud2 &out return; } // Send the input dataset to the spatial locator - pcl::PointCloud::Ptr cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr cloud = pcl::make_shared> (); pcl::fromPCLPointCloud2 (*input_, *cloud); // Initialize the spatial locator if (!tree_) { if (cloud->isOrganized ()) - tree_.reset (new pcl::search::OrganizedNeighbor ()); + tree_ = pcl::make_shared> (); else - tree_.reset (new pcl::search::KdTree (false)); + tree_ = pcl::make_shared> (false); } tree_->setInputCloud (cloud); @@ -120,6 +121,7 @@ pcl::RadiusOutlierRemoval::applyFilter (PCLPointCloud2 &out #ifndef PCL_NO_PRECOMPILE #include + #include // Instantiations of specific point types diff --git a/filters/src/statistical_outlier_removal.cpp b/filters/src/statistical_outlier_removal.cpp index 2183b4c3b90..cc9cda4e88a 100644 --- a/filters/src/statistical_outlier_removal.cpp +++ b/filters/src/statistical_outlier_removal.cpp @@ -40,6 +40,7 @@ #include #include +#include using namespace std; @@ -191,16 +192,16 @@ pcl::StatisticalOutlierRemoval::generateStatistics (double& std::vector& distances) { // Send the input dataset to the spatial locator - pcl::PointCloud::Ptr cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr cloud = pcl::make_shared> (); pcl::fromPCLPointCloud2 (*input_, *cloud); // Initialize the spatial locator if (!tree_) { if (cloud->isOrganized ()) - tree_.reset (new pcl::search::OrganizedNeighbor ()); + tree_ = pcl::make_shared> (); else - tree_.reset (new pcl::search::KdTree (false)); + tree_ = pcl::make_shared> (false); } tree_->setInputCloud (cloud); @@ -253,6 +254,7 @@ pcl::StatisticalOutlierRemoval::generateStatistics (double& #ifndef PCL_NO_PRECOMPILE #include + #include // Instantiations of specific point types diff --git a/io/src/hdl_grabber.cpp b/io/src/hdl_grabber.cpp index 69708c227c6..483fa4c1e51 100644 --- a/io/src/hdl_grabber.cpp +++ b/io/src/hdl_grabber.cpp @@ -47,6 +47,8 @@ #include #include #include + +#include #ifdef HAVE_PCAP #include #endif // #ifdef HAVE_PCAP @@ -159,10 +161,10 @@ pcl::HDLGrabber::initialize (const std::string& correctionsFile) scan_xyzrgba_signal_ = createSignal (); scan_xyzi_signal_ = createSignal (); - current_scan_xyz_.reset (new pcl::PointCloud); - current_scan_xyzi_.reset (new pcl::PointCloud); - current_sweep_xyz_.reset (new pcl::PointCloud); - current_sweep_xyzi_.reset (new pcl::PointCloud); + current_scan_xyz_ = pcl::make_shared> (); + current_scan_xyzi_ = pcl::make_shared> (); + current_sweep_xyz_ = pcl::make_shared> (); + current_sweep_xyzi_ = pcl::make_shared> (); for (auto &rgb : laser_rgb_mapping_) rgb.r = rgb.g = rgb.b = 0; @@ -316,9 +318,9 @@ pcl::HDLGrabber::toPointClouds (HDLDataPacket *dataPacket) if (sizeof(HDLLaserReturn) != 3) return; - current_scan_xyz_.reset (new pcl::PointCloud ()); - current_scan_xyzrgba_.reset (new pcl::PointCloud ()); - current_scan_xyzi_.reset (new pcl::PointCloud ()); + current_scan_xyz_ = pcl::make_shared> (); + current_scan_xyzrgba_ = pcl::make_shared> (); + current_scan_xyzi_ = pcl::make_shared> (); time_t system_time; time (&system_time); @@ -354,9 +356,9 @@ pcl::HDLGrabber::toPointClouds (HDLDataPacket *dataPacket) fireCurrentSweep (); } - current_sweep_xyz_.reset (new pcl::PointCloud ()); - current_sweep_xyzrgba_.reset (new pcl::PointCloud ()); - current_sweep_xyzi_.reset (new pcl::PointCloud ()); + current_sweep_xyz_ = pcl::make_shared> (); + current_sweep_xyzrgba_ = pcl::make_shared> (); + current_sweep_xyzi_ = pcl::make_shared> (); } PointXYZ xyz; diff --git a/io/src/openni_camera/openni_driver.cpp b/io/src/openni_camera/openni_driver.cpp index 43cc672fefa..ca16b576cf8 100644 --- a/io/src/openni_camera/openni_driver.cpp +++ b/io/src/openni_camera/openni_driver.cpp @@ -55,6 +55,8 @@ #include #include +#include + #ifndef _WIN32 #include #else @@ -111,7 +113,7 @@ openni_wrapper::OpenNIDriver::updateDeviceList () if ( connection_string_map_.count ((*neededIt).GetCreationInfo ()) ) { unsigned device_index = connection_string_map_[(*neededIt).GetCreationInfo ()]; - device_context_[device_index].depth_node.reset (new xn::NodeInfo(*nodeIt)); + device_context_[device_index].depth_node = pcl::make_shared (*nodeIt); } } } @@ -134,7 +136,7 @@ openni_wrapper::OpenNIDriver::updateDeviceList () if ( connection_string_map_.count ((*neededIt).GetCreationInfo ()) ) { unsigned device_index = connection_string_map_[(*neededIt).GetCreationInfo ()]; - device_context_[device_index].image_node.reset (new xn::NodeInfo(*nodeIt)); + device_context_[device_index].image_node = pcl::make_shared (*nodeIt); } } } @@ -154,7 +156,7 @@ openni_wrapper::OpenNIDriver::updateDeviceList () if ( connection_string_map_.count ((*neededIt).GetCreationInfo ()) ) { unsigned device_index = connection_string_map_[(*neededIt).GetCreationInfo ()]; - device_context_[device_index].ir_node.reset (new xn::NodeInfo(*nodeIt)); + device_context_[device_index].ir_node = pcl::make_shared (*nodeIt); } } } @@ -260,26 +262,26 @@ openni_wrapper::OpenNIDriver::getDeviceByIndex (unsigned index) const if (vendor_id == 0x45e) { - device.reset (new DeviceKinect (context_, + device = pcl::make_shared (context_, device_context_[index].device_node, *device_context_[index].image_node, *device_context_[index].depth_node, - *device_context_[index].ir_node)); + *device_context_[index].ir_node); device_context_[index].device = device; } else if (vendor_id == 0x1d27) { if (device_context_[index].image_node.get()) - device.reset (new DevicePrimesense (context_, + device = pcl::make_shared (context_, device_context_[index].device_node, *device_context_[index].image_node, *device_context_[index].depth_node, - *device_context_[index].ir_node)); + *device_context_[index].ir_node); else - device.reset (new DeviceXtionPro (context_, + device = pcl::make_shared (context_, device_context_[index].device_node, *device_context_[index].depth_node, - *device_context_[index].ir_node)); + *device_context_[index].ir_node); device_context_[index].device = device; } else diff --git a/io/src/robot_eye_grabber.cpp b/io/src/robot_eye_grabber.cpp index febfc41d306..8b5079e5952 100644 --- a/io/src/robot_eye_grabber.cpp +++ b/io/src/robot_eye_grabber.cpp @@ -38,6 +38,8 @@ #include #include +#include + ///////////////////////////////////////////////////////////////////////////// pcl::RobotEyeGrabber::RobotEyeGrabber () : terminate_thread_ (false) @@ -141,7 +143,7 @@ pcl::RobotEyeGrabber::getPointCloud () const void pcl::RobotEyeGrabber::resetPointCloud () { - point_cloud_xyzi_.reset (new pcl::PointCloud); + point_cloud_xyzi_ = pcl::make_shared> (); point_cloud_xyzi_->is_dense = true; } @@ -311,7 +313,7 @@ pcl::RobotEyeGrabber::start () try { - socket_.reset (new boost::asio::ip::udp::socket (io_service_, destinationEndpoint)); + socket_ = pcl::make_shared (io_service_, destinationEndpoint); } catch (std::exception &e) { @@ -321,8 +323,8 @@ pcl::RobotEyeGrabber::start () terminate_thread_ = false; resetPointCloud (); - consumer_thread_.reset(new std::thread (&RobotEyeGrabber::consumerThreadLoop, this)); - socket_thread_.reset(new std::thread (&RobotEyeGrabber::socketThreadLoop, this)); + consumer_thread_ = pcl::make_shared(&RobotEyeGrabber::consumerThreadLoop, this); + socket_thread_ = pcl::make_shared(&RobotEyeGrabber::socketThreadLoop, this); } ///////////////////////////////////////////////////////////////////////////// diff --git a/io/src/vlp_grabber.cpp b/io/src/vlp_grabber.cpp index e9c6a9e4db8..922aa2b02a3 100644 --- a/io/src/vlp_grabber.cpp +++ b/io/src/vlp_grabber.cpp @@ -38,6 +38,8 @@ #include +#include + using boost::asio::ip::udp; ///////////////////////////////////////////////////////////////////////////// @@ -156,9 +158,9 @@ pcl::VLPGrabber::toPointClouds (HDLDataPacket *dataPacket) HDLGrabber::fireCurrentSweep (); } - current_sweep_xyz_.reset (new pcl::PointCloud ()); - current_sweep_xyzrgba_.reset (new pcl::PointCloud ()); - current_sweep_xyzi_.reset (new pcl::PointCloud ()); + current_sweep_xyz_ = pcl::make_shared> (); + current_sweep_xyzrgba_ = pcl::make_shared> (); + current_sweep_xyzi_ = pcl::make_shared> (); } PointXYZ xyz; diff --git a/keypoints/src/agast_2d.cpp b/keypoints/src/agast_2d.cpp index 3bb279c93a3..108822375bc 100644 --- a/keypoints/src/agast_2d.cpp +++ b/keypoints/src/agast_2d.cpp @@ -40,6 +40,8 @@ #include #include +#include + ///////////////////////////////////////////////////////////////////////////////////////// void pcl::AgastKeypoint2D::detectKeypoints (pcl::PointCloud &output) @@ -55,7 +57,7 @@ pcl::AgastKeypoint2D::detectKeypoints (pcl::PointCl image_data[i] = static_cast (intensity_ ((*input_)[i])); if (!detector_) - detector_.reset (new pcl::keypoints::agast::AgastDetector7_12s (width, height, threshold_, bmax_)); + detector_ = pcl::make_shared (width, height, threshold_, bmax_); detector_->setMaxKeypoints (nr_max_keypoints_); diff --git a/keypoints/src/brisk_2d.cpp b/keypoints/src/brisk_2d.cpp index a2c7234f2b9..cd20c224851 100644 --- a/keypoints/src/brisk_2d.cpp +++ b/keypoints/src/brisk_2d.cpp @@ -42,6 +42,8 @@ #include #include #include + +#include #if defined(__SSSE3__) && !defined(__i386__) #include #include @@ -1304,8 +1306,8 @@ pcl::keypoints::brisk::Layer::Layer ( offset_ = offset; // create an agast detector - oast_detector_.reset (new pcl::keypoints::agast::OastDetector9_16 (img_width_, img_height_, 0)); - agast_detector_5_8_.reset (new pcl::keypoints::agast::AgastDetector5_8 (img_width_, img_height_, 0)); + oast_detector_ = pcl::make_shared (img_width_, img_height_, 0); + agast_detector_5_8_ = pcl::make_shared (img_width_, img_height_, 0); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1336,8 +1338,8 @@ pcl::keypoints::brisk::Layer::Layer (const pcl::keypoints::brisk::Layer& layer, scores_ = std::vector (img_width_ * img_height_, 0); // create an agast detector - oast_detector_.reset (new pcl::keypoints::agast::OastDetector9_16 (img_width_, img_height_, 0)); - agast_detector_5_8_.reset (new pcl::keypoints::agast::AgastDetector5_8 (img_width_, img_height_, 0)); + oast_detector_ = pcl::make_shared (img_width_, img_height_, 0); + agast_detector_5_8_ = pcl::make_shared (img_width_, img_height_, 0); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/outofcore/src/visualization/outofcore_cloud.cpp b/outofcore/src/visualization/outofcore_cloud.cpp index 7edf82f2cc4..35f2616f367 100644 --- a/outofcore/src/visualization/outofcore_cloud.cpp +++ b/outofcore/src/visualization/outofcore_cloud.cpp @@ -34,6 +34,8 @@ #include #include +#include + // Forward Declarations @@ -118,7 +120,8 @@ OutofcoreCloud::OutofcoreCloud (std::string name, boost::filesystem::path& tree_ if (!OutofcoreCloud::pcd_reader_thread) OutofcoreCloud::pcd_reader_thread.reset (new std::thread (&OutofcoreCloud::pcdReaderThread)); - octree_.reset (new OctreeDisk (tree_root, true)); + + octree_ = pcl::make_shared (tree_root, true); octree_->getBoundingBox (bbox_min_, bbox_max_); voxel_actor_ = vtkSmartPointer::New (); diff --git a/people/include/pcl/people/impl/ground_based_people_detection_app.hpp b/people/include/pcl/people/impl/ground_based_people_detection_app.hpp index fdedb6f33e2..9ad75e204ad 100644 --- a/people/include/pcl/people/impl/ground_based_people_detection_app.hpp +++ b/people/include/pcl/people/impl/ground_based_people_detection_app.hpp @@ -43,10 +43,13 @@ #include +#include +#include + template pcl::people::GroundBasedPeopleDetectionApp::GroundBasedPeopleDetectionApp () { - rgb_image_ = pcl::PointCloud::Ptr(new pcl::PointCloud); + rgb_image_ = pcl::make_shared> (); // set default values for optional parameters: sampling_factor_ = 1; @@ -239,7 +242,7 @@ pcl::people::GroundBasedPeopleDetectionApp::extractRGBFromPointCloud (Po template void pcl::people::GroundBasedPeopleDetectionApp::swapDimensions (pcl::PointCloud::Ptr& cloud) { - pcl::PointCloud::Ptr output_cloud(new pcl::PointCloud); + pcl::PointCloud::Ptr output_cloud = pcl::make_shared> (); output_cloud->points.resize(cloud->height*cloud->width); output_cloud->width = cloud->height; output_cloud->height = cloud->width; @@ -295,7 +298,7 @@ pcl::people::GroundBasedPeopleDetectionApp::applyTransformationIntrinsic template void pcl::people::GroundBasedPeopleDetectionApp::filter () { - cloud_filtered_ = PointCloudPtr (new PointCloud); + cloud_filtered_ = pcl::make_shared (); pcl::VoxelGrid grid; grid.setInputCloud(cloud_); grid.setLeafSize(voxel_size_, voxel_size_, voxel_size_); @@ -336,7 +339,7 @@ pcl::people::GroundBasedPeopleDetectionApp::compute (std::vector (); cloud_downsampled->width = (cloud_->width)/sampling_factor_; cloud_downsampled->height = (cloud_->height)/sampling_factor_; cloud_downsampled->points.resize(cloud_downsampled->height*cloud_downsampled->width); @@ -356,10 +359,10 @@ pcl::people::GroundBasedPeopleDetectionApp::compute (std::vector); - typename pcl::SampleConsensusModelPlane::Ptr ground_model (new pcl::SampleConsensusModelPlane (cloud_filtered_)); + pcl::IndicesPtr inliers = pcl::make_shared> (); + typename pcl::SampleConsensusModelPlane::Ptr ground_model = pcl::make_shared> (cloud_filtered_); ground_model->selectWithinDistance(ground_coeffs_transformed_, 2 * voxel_size_, *inliers); - no_ground_cloud_ = PointCloudPtr (new PointCloud); + no_ground_cloud_ = pcl::make_shared (); pcl::ExtractIndices extract; extract.setInputCloud(cloud_filtered_); extract.setIndices(inliers); @@ -372,7 +375,7 @@ pcl::people::GroundBasedPeopleDetectionApp::compute (std::vector cluster_indices; - typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); + typename pcl::search::KdTree::Ptr tree = pcl::make_shared > (); tree->setInputCloud(no_ground_cloud_); pcl::EuclideanClusterExtraction ec; ec.setClusterTolerance(2 * voxel_size_); diff --git a/recognition/src/face_detection/face_detector_data_provider.cpp b/recognition/src/face_detection/face_detector_data_provider.cpp index c99125b4d31..ac96b911298 100644 --- a/recognition/src/face_detection/face_detector_data_provider.cpp +++ b/recognition/src/face_detection/face_detector_data_provider.cpp @@ -1,4 +1,5 @@ #include "pcl/recognition/face_detection/face_detector_data_provider.h" +#include #include "pcl/recognition/face_detection/face_common.h" #include #include @@ -246,7 +247,7 @@ void pcl::face_detection::FaceDetectorDataProvider::Ptr integral_image_depth; - integral_image_depth.reset (new pcl::IntegralImage2D (false)); + integral_image_depth = pcl::make_shared> (false); int element_stride = sizeof(pcl::PointXYZ) / sizeof(float); int row_stride = element_stride * cloud->width; @@ -277,15 +278,15 @@ void pcl::face_detection::FaceDetectorDataProvider (false)); + integral_image_normal_x = pcl::make_shared> (false); const float *data_nx = reinterpret_cast (&normals->points[0]); integral_image_normal_x->setInput (data_nx, normals->width, normals->height, element_stride_normal, row_stride_normal); - integral_image_normal_y.reset (new pcl::IntegralImage2D (false)); + integral_image_normal_y = pcl::make_shared> (false); const float *data_ny = reinterpret_cast (&normals->points[0]); integral_image_normal_y->setInput (data_ny + 1, normals->width, normals->height, element_stride_normal, row_stride_normal); - integral_image_normal_z.reset (new pcl::IntegralImage2D (false)); + integral_image_normal_z = pcl::make_shared> (false); const float *data_nz = reinterpret_cast (&normals->points[0]); integral_image_normal_z->setInput (data_nz + 2, normals->width, normals->height, element_stride_normal, row_stride_normal); } diff --git a/recognition/src/face_detection/rf_face_detector_trainer.cpp b/recognition/src/face_detection/rf_face_detector_trainer.cpp index 7f55ee5af0a..fd910fadca6 100644 --- a/recognition/src/face_detection/rf_face_detector_trainer.cpp +++ b/recognition/src/face_detection/rf_face_detector_trainer.cpp @@ -6,21 +6,22 @@ */ #include "pcl/recognition/face_detection/rf_face_detector_trainer.h" -#include "pcl/recognition/face_detection/face_common.h" +#include "pcl/filters/passthrough.h" +#include "pcl/filters/voxel_grid.h" #include "pcl/io/pcd_io.h" -#include "pcl/ml/dt/decision_tree_trainer.h" -#include "pcl/ml/dt/decision_tree_evaluator.h" -#include "pcl/ml/dt/decision_forest_trainer.h" +#include #include "pcl/ml/dt/decision_forest_evaluator.h" -#include "pcl/filters/passthrough.h" +#include "pcl/ml/dt/decision_forest_trainer.h" +#include "pcl/ml/dt/decision_tree_evaluator.h" +#include "pcl/ml/dt/decision_tree_trainer.h" +#include "pcl/recognition/face_detection/face_common.h" #include -#include -#include +#include +#include #include #include -#include "pcl/filters/voxel_grid.h" -#include -#include +#include +#include void pcl::RFFaceDetectorTrainer::trainWithDataProvider() { @@ -50,7 +51,7 @@ void pcl::RFFaceDetectorTrainer::trainWithDataProvider() dft.setThresholds (thresholds_); typename face_detection::FaceDetectorDataProvider, float, int, NodeType>::Ptr dtdp; - dtdp.reset (new face_detection::FaceDetectorDataProvider, float, int, NodeType>); + dtdp = pcl::make_shared, float, int, NodeType>> (); dtdp->setUseNormals (use_normals_); dtdp->setWSize (w_size_); dtdp->setNumImages (num_images_); @@ -230,7 +231,7 @@ void pcl::RFFaceDetectorTrainer::setModelPath(std::string & model) pcl::PointCloud::Ptr model_cloud (new pcl::PointCloud ()); pcl::io::loadPCDFile (model_path_, *model_cloud); - model_original_.reset (new pcl::PointCloud ()); + model_original_ = pcl::make_shared> (); { pcl::VoxelGrid voxel_grid_icp; @@ -270,7 +271,7 @@ void pcl::RFFaceDetectorTrainer::detectFaces() //compute depth integral image pcl::IntegralImage2D::Ptr integral_image_depth; - integral_image_depth.reset (new pcl::IntegralImage2D (false)); + integral_image_depth = pcl::make_shared> (false); int element_stride = sizeof(pcl::PointXYZ) / sizeof(float); int row_stride = element_stride * cloud->width; @@ -299,15 +300,15 @@ void pcl::RFFaceDetectorTrainer::detectFaces() if (use_normals_) { - integral_image_normal_x.reset (new pcl::IntegralImage2D (false)); + integral_image_normal_x = pcl::make_shared> (false); const float *data_nx = reinterpret_cast (&normals->points[0]); integral_image_normal_x->setInput (data_nx, normals->width, normals->height, element_stride_normal, row_stride_normal); - integral_image_normal_y.reset (new pcl::IntegralImage2D (false)); + integral_image_normal_y = pcl::make_shared> (false); const float *data_ny = reinterpret_cast (&normals->points[0]); integral_image_normal_y->setInput (data_ny + 1, normals->width, normals->height, element_stride_normal, row_stride_normal); - integral_image_normal_z.reset (new pcl::IntegralImage2D (false)); + integral_image_normal_z = pcl::make_shared> (false); const float *data_nz = reinterpret_cast (&normals->points[0]); integral_image_normal_z->setInput (data_nz + 2, normals->width, normals->height, element_stride_normal, row_stride_normal); } @@ -410,7 +411,7 @@ void pcl::RFFaceDetectorTrainer::detectFaces() if (face_heat_map_) { - face_heat_map_.reset (new pcl::PointCloud); + face_heat_map_ = pcl::make_shared> (); face_heat_map_->resize (cloud->points.size ()); face_heat_map_->height = 1; face_heat_map_->width = static_cast(cloud->points.size ()); diff --git a/recognition/src/ransac_based/obj_rec_ransac.cpp b/recognition/src/ransac_based/obj_rec_ransac.cpp index b16b9b6c93f..47d3aae7d41 100644 --- a/recognition/src/ransac_based/obj_rec_ransac.cpp +++ b/recognition/src/ransac_based/obj_rec_ransac.cpp @@ -40,6 +40,8 @@ #include #include +#include + using namespace std; using namespace pcl::common; @@ -77,7 +79,7 @@ pcl::recognition::ObjRecRANSAC::recognize (const PointCloudIn& scene, const Poin scene_octree_proj_.build(scene_octree_, abs_zdist_thresh_, abs_zdist_thresh_); // Needed only if icp hypotheses refinement is to be performed - scene_octree_points_ = PointCloudIn::Ptr (new PointCloudIn ()); + scene_octree_points_ = pcl::make_shared(); // First, get the scene octree points scene_octree_.getFullLeavesPoints (*scene_octree_points_); diff --git a/registration/include/pcl/registration/gicp6d.h b/registration/include/pcl/registration/gicp6d.h index 9d4dda9cbc4..b1eaec1361d 100644 --- a/registration/include/pcl/registration/gicp6d.h +++ b/registration/include/pcl/registration/gicp6d.h @@ -43,6 +43,8 @@ #include #include #include + +#include #include namespace pcl @@ -186,7 +188,7 @@ namespace pcl inline Ptr makeShared () const { - return Ptr (new MyPointRepresentation (*this)); + return pcl::make_shared(*this); } void diff --git a/registration/include/pcl/registration/impl/ia_fpcs.hpp b/registration/include/pcl/registration/impl/ia_fpcs.hpp index 37f7f41f58a..342475d5b7b 100644 --- a/registration/include/pcl/registration/impl/ia_fpcs.hpp +++ b/registration/include/pcl/registration/impl/ia_fpcs.hpp @@ -44,6 +44,8 @@ #include #include +#include + /////////////////////////////////////////////////////////////////////////////////////////// template inline float pcl::getMeanPointDensity (const typename pcl::PointCloud::ConstPtr &cloud, float max_dist, int nr_threads) @@ -259,7 +261,7 @@ pcl::registration::FPCSInitialAlignment (indices_->size ()); const int sample_fraction_src = std::max (1, static_cast (ss / nr_samples_)); - source_indices_ = pcl::IndicesPtr (new std::vector ); + source_indices_ = pcl::make_shared>(); for (int i = 0; i < ss; i++) if (rand () % sample_fraction_src == 0) source_indices_->push_back ((*indices_) [i]); diff --git a/registration/include/pcl/registration/impl/icp.hpp b/registration/include/pcl/registration/impl/icp.hpp index bbfad6b894d..0e5f50eea4d 100644 --- a/registration/include/pcl/registration/impl/icp.hpp +++ b/registration/include/pcl/registration/impl/icp.hpp @@ -44,6 +44,8 @@ #include #include +#include + /////////////////////////////////////////////////////////////////////////////////////////// template void pcl::IterativeClosestPoint::transformCloud ( @@ -175,7 +177,7 @@ pcl::IterativeClosestPoint::computeTransformat PCLPointCloud2::Ptr input_transformed_blob; if (need_source_blob_) { - input_transformed_blob.reset (new PCLPointCloud2); + input_transformed_blob = pcl::make_shared (); toPCLPointCloud2 (*input_transformed, *input_transformed_blob); } // Save the previously estimated transformation diff --git a/registration/include/pcl/registration/impl/joint_icp.hpp b/registration/include/pcl/registration/impl/joint_icp.hpp index 9245ecf61ce..be6ee95e655 100644 --- a/registration/include/pcl/registration/impl/joint_icp.hpp +++ b/registration/include/pcl/registration/impl/joint_icp.hpp @@ -43,6 +43,8 @@ #include #include +#include + /////////////////////////////////////////////////////////////////////////////////////////// template void @@ -156,7 +158,7 @@ pcl::JointIterativeClosestPoint::computeTransf std::vector partial_correspondences_ (sources_.size ()); for (size_t i = 0; i < sources_.size (); i++) { - partial_correspondences_[i].reset (new pcl::Correspondences); + partial_correspondences_[i] = pcl::make_shared (); } do @@ -203,7 +205,7 @@ pcl::JointIterativeClosestPoint::computeTransf PCLPointCloud2::Ptr inputs_transformed_combined_blob; if (need_source_blob_) { - inputs_transformed_combined_blob.reset (new PCLPointCloud2); + inputs_transformed_combined_blob = pcl::make_shared (); toPCLPointCloud2 (*inputs_transformed_combined, *inputs_transformed_combined_blob); } CorrespondencesPtr temp_correspondences (new Correspondences (*correspondences_)); diff --git a/registration/include/pcl/registration/ppf_registration.h b/registration/include/pcl/registration/ppf_registration.h index 5066c9f9afc..c113ca2cfee 100644 --- a/registration/include/pcl/registration/ppf_registration.h +++ b/registration/include/pcl/registration/ppf_registration.h @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -88,7 +89,7 @@ namespace pcl */ PPFHashMapSearch (float angle_discretization_step = 12.0f / 180.0f * static_cast (M_PI), float distance_discretization_step = 0.01f) - : feature_hash_map_ (new FeatureHashMapType) + : feature_hash_map_ (pcl::make_shared ()) , internals_initialized_ (false) , angle_discretization_step_ (angle_discretization_step) , distance_discretization_step_ (distance_discretization_step) @@ -116,7 +117,7 @@ namespace pcl /** \brief Convenience method for returning a copy of the class instance as a boost::shared_ptr */ Ptr - makeShared() { return Ptr (new PPFHashMapSearch (*this)); } + makeShared() { return pcl::make_shared(*this); } /** \brief Returns the angle discretization step parameter (the step value between each bin of the hash map for the angular values) */ inline float @@ -296,3 +297,4 @@ namespace pcl } #include + diff --git a/registration/src/gicp6d.cpp b/registration/src/gicp6d.cpp index 76c876ff474..74a5706f4a4 100644 --- a/registration/src/gicp6d.cpp +++ b/registration/src/gicp6d.cpp @@ -38,6 +38,8 @@ #include +#include + namespace pcl { // convert sRGB to CIELAB @@ -193,13 +195,13 @@ namespace pcl // Compute target cloud covariance matrices if ((!target_covariances_) || (target_covariances_->empty ())) { - target_covariances_.reset (new MatricesVector); + target_covariances_ = pcl::make_shared (); computeCovariances (target_, tree_, *target_covariances_); } // Compute input cloud covariance matrices if ((!input_covariances_) || (input_covariances_->empty ())) { - input_covariances_.reset (new MatricesVector); + input_covariances_ = pcl::make_shared (); computeCovariances (input_, tree_reciprocal_, *input_covariances_); } diff --git a/search/include/pcl/search/impl/flann_search.hpp b/search/include/pcl/search/impl/flann_search.hpp index 1d5da38fd5f..797f8f0ff3b 100644 --- a/search/include/pcl/search/impl/flann_search.hpp +++ b/search/include/pcl/search/impl/flann_search.hpp @@ -46,6 +46,8 @@ #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// template typename pcl::search::FlannSearch::IndexPtr @@ -379,12 +381,12 @@ pcl::search::FlannSearch::convertInputToFlannMatrix () if (input_->is_dense && point_representation_->isTrivial ()) { // const cast is evil, but flann won't change the data - input_flann_ = MatrixPtr (new flann::Matrix (const_cast(reinterpret_cast(&(*input_) [0])), original_no_of_points, point_representation_->getNumberOfDimensions (),sizeof (PointT))); + input_flann_ = pcl::make_shared>(const_cast(reinterpret_cast(&(*input_) [0])), original_no_of_points, point_representation_->getNumberOfDimensions (),sizeof (PointT)); input_copied_for_flann_ = false; } else { - input_flann_ = MatrixPtr (new flann::Matrix (new float[original_no_of_points*point_representation_->getNumberOfDimensions ()], original_no_of_points, point_representation_->getNumberOfDimensions ())); + input_flann_ = pcl::make_shared>(new float[original_no_of_points*point_representation_->getNumberOfDimensions ()], original_no_of_points, point_representation_->getNumberOfDimensions ()); float* cloud_ptr = input_flann_->ptr(); for (size_t i = 0; i < original_no_of_points; ++i) { @@ -406,7 +408,7 @@ pcl::search::FlannSearch::convertInputToFlannMatrix () } else { - input_flann_ = MatrixPtr (new flann::Matrix (new float[original_no_of_points*point_representation_->getNumberOfDimensions ()], original_no_of_points, point_representation_->getNumberOfDimensions ())); + input_flann_ = pcl::make_shared>(new float[original_no_of_points*point_representation_->getNumberOfDimensions ()], original_no_of_points, point_representation_->getNumberOfDimensions ()); float* cloud_ptr = input_flann_->ptr(); for (size_t indices_index = 0; indices_index < original_no_of_points; ++indices_index) { diff --git a/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp index 910148ead80..35bd2c06bee 100644 --- a/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp @@ -40,6 +40,8 @@ #include +#include + template pcl::CPCSegmentation::CPCSegmentation () : max_cuts_ (20), @@ -92,7 +94,7 @@ pcl::CPCSegmentation::applyCuttingPlane (uint32_t depth_levels_left) if (depth_levels_left <= 0) return; - pcl::IndicesPtr support_indices (new pcl::Indices); + pcl::IndicesPtr support_indices = pcl::make_shared (); SegLabel2ClusterMap seg_to_edge_points_map; std::map > seg_to_edgeIDs_map; EdgeIterator edge_itr, edge_itr_end, next_edge; @@ -130,7 +132,7 @@ pcl::CPCSegmentation::applyCuttingPlane (uint32_t depth_levels_left) edge_centroid.intensity = sv_adjacency_list_[*edge_itr].is_convex ? -sv_adjacency_list_[*edge_itr].normal_difference : sv_adjacency_list_[*edge_itr].normal_difference; if (seg_to_edge_points_map.find (source_segment_label) == seg_to_edge_points_map.end ()) { - seg_to_edge_points_map[source_segment_label] = pcl::PointCloud::Ptr (new pcl::PointCloud ()); + seg_to_edge_points_map[source_segment_label] = pcl::make_shared> (); } seg_to_edge_points_map[source_segment_label]->push_back (edge_centroid); seg_to_edgeIDs_map[source_segment_label].push_back (*edge_itr); @@ -155,7 +157,7 @@ pcl::CPCSegmentation::applyCuttingPlane (uint32_t depth_levels_left) } pcl::PointCloud::Ptr edge_cloud_cluster = seg_to_edge_points.second; - pcl::SampleConsensusModelPlane::Ptr model_p (new pcl::SampleConsensusModelPlane (edge_cloud_cluster)); + pcl::SampleConsensusModelPlane::Ptr model_p = pcl::make_shared> (edge_cloud_cluster); WeightedRandomSampleConsensus weight_sac (model_p, seed_resolution_, true); @@ -186,7 +188,7 @@ pcl::CPCSegmentation::applyCuttingPlane (uint32_t depth_levels_left) // We also just actually cut when the edge goes through the plane. This is why we check the planedistance std::vector cluster_indices; pcl::EuclideanClusterExtraction euclidean_clusterer; - pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); tree->setInputCloud (edge_cloud_cluster); euclidean_clusterer.setClusterTolerance (seed_resolution_); euclidean_clusterer.setMinClusterSize (1); @@ -324,7 +326,7 @@ pcl::CPCSegmentation::WeightedRandomSampleConsensus::computeModel (int) // weight distances to get the score (only using connected inliers) sac_model_->setIndices (full_cloud_pt_indices_); - pcl::IndicesPtr current_inliers (new pcl::Indices); + pcl::IndicesPtr current_inliers = pcl::make_shared (); sac_model_->selectWithinDistance (model_coefficients, threshold_, *current_inliers); double current_score = 0; Eigen::Vector3f plane_normal (model_coefficients[0], model_coefficients[1], model_coefficients[2]); diff --git a/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp index 0a714afbdaa..10506f3ed61 100644 --- a/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp @@ -41,6 +41,8 @@ #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// void pcl::seededHueSegmentation (const PointCloud &cloud, @@ -208,9 +210,9 @@ pcl::SeededHueSegmentation::segment (PointIndices &indices_in, PointIndices &ind if (!tree_) { if (input_->isOrganized ()) - tree_.reset (new pcl::search::OrganizedNeighbor ()); + tree_ = pcl::make_shared> (); else - tree_.reset (new pcl::search::KdTree (false)); + tree_ = pcl::make_shared> (false); } // Send the input dataset to the spatial locator diff --git a/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp b/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp index 797c2fcf6a1..71731c2e6f5 100644 --- a/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp +++ b/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp @@ -42,6 +42,8 @@ #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template pcl::SupervoxelClustering::SupervoxelClustering (float voxel_resolution, float seed_resolution) : @@ -907,7 +909,7 @@ pcl::SupervoxelClustering::SupervoxelHelper::getVoxels (typename pcl::Po template void pcl::SupervoxelClustering::SupervoxelHelper::getNormals (typename pcl::PointCloud::Ptr &normals) const { - normals.reset (new pcl::PointCloud); + normals = pcl::make_shared> (); normals->clear (); normals->resize (leaves_.size ()); typename pcl::PointCloud::iterator normal_itr = normals->begin (); diff --git a/segmentation/include/pcl/segmentation/supervoxel_clustering.h b/segmentation/include/pcl/segmentation/supervoxel_clustering.h index 001d255e058..cf4c93071f5 100644 --- a/segmentation/include/pcl/segmentation/supervoxel_clustering.h +++ b/segmentation/include/pcl/segmentation/supervoxel_clustering.h @@ -42,6 +42,7 @@ #include +#include #include #include #include @@ -60,16 +61,16 @@ namespace pcl { - /** \brief Supervoxel container class - stores a cluster extracted using supervoxel clustering + /** \brief Supervoxel container class - stores a cluster extracted using supervoxel clustering */ template class Supervoxel { public: Supervoxel () : - voxels_ (new pcl::PointCloud ()), - normals_ (new pcl::PointCloud ()) - { } + voxels_ (pcl::make_shared> ()), + normals_ (pcl::make_shared> ()) + { } using Ptr = boost::shared_ptr >; using ConstPtr = boost::shared_ptr >; @@ -279,8 +280,8 @@ namespace pcl [[deprecated("use getLabeledCloud() instead. An example of how to display and save with colorized labels can be found in examples/segmentation/example_supervoxels.cpp")]] typename pcl::PointCloud::Ptr getColoredCloud () const - { - return pcl::PointCloud::Ptr (new pcl::PointCloud); + { + return pcl::make_shared> (); } /** \brief Returns a deep copy of the voxel centroid cloud */ @@ -305,7 +306,7 @@ namespace pcl pcl::PointCloud::Ptr getColoredVoxelCloud () const { - return pcl::PointCloud::Ptr (new pcl::PointCloud); + return pcl::make_shared> (); } /** \brief Returns labeled voxelized cloud diff --git a/simulation/src/glsl_shader.cpp b/simulation/src/glsl_shader.cpp index 99ccc980b83..8381d438091 100644 --- a/simulation/src/glsl_shader.cpp +++ b/simulation/src/glsl_shader.cpp @@ -9,6 +9,8 @@ #include #include +#include + using namespace pcl::simulation::gllib; char* @@ -205,7 +207,7 @@ Program::Ptr pcl::simulation::gllib::Program::loadProgramFromText (const std::string& vertex_shader_text, const std::string& fragment_shader_text) { // Load shader - Program::Ptr program = gllib::Program::Ptr (new gllib::Program ()); + Program::Ptr program = pcl::make_shared(); if (!program->addShaderText (vertex_shader_text, gllib::VERTEX)) { std::cerr << "Failed loading vertex shader" << std::endl; @@ -226,7 +228,7 @@ Program::Ptr pcl::simulation::gllib::Program::loadProgramFromFile (const std::string& vertex_shader_file, const std::string& fragment_shader_file) { // Load shader - Program::Ptr program = gllib::Program::Ptr (new gllib::Program ()); + Program::Ptr program = pcl::make_shared(); if (!program->addShaderFile (vertex_shader_file, gllib::VERTEX)) { std::cerr << "Failed loading vertex shader" << std::endl; diff --git a/simulation/src/range_likelihood.cpp b/simulation/src/range_likelihood.cpp index f4f7d704e36..78747540bec 100644 --- a/simulation/src/range_likelihood.cpp +++ b/simulation/src/range_likelihood.cpp @@ -3,6 +3,8 @@ #include +#include + #include #include @@ -290,7 +292,7 @@ pcl::simulation::RangeLikelihood::RangeLikelihood (int rows, int cols, int row_h glBindFramebuffer (GL_FRAMEBUFFER, 0); // Load shader - likelihood_program_ = gllib::Program::Ptr (new gllib::Program ()); + likelihood_program_ = pcl::make_shared(); // TODO: to remove file dependency include the shader source in the binary if (!likelihood_program_->addShaderFile ("compute_score.vert", gllib::VERTEX)) { diff --git a/simulation/src/sum_reduce.cpp b/simulation/src/sum_reduce.cpp index 54da1273de7..c984858addc 100644 --- a/simulation/src/sum_reduce.cpp +++ b/simulation/src/sum_reduce.cpp @@ -1,5 +1,7 @@ #include +#include + using namespace pcl::simulation; pcl::simulation::SumReduce::SumReduce (int width, int height, int levels) : levels_ (levels), @@ -9,7 +11,7 @@ pcl::simulation::SumReduce::SumReduce (int width, int height, int levels) : leve std::cout << "SumReduce: levels: " << levels_ << std::endl; // Load shader - sum_program_ = gllib::Program::Ptr (new gllib::Program ()); + sum_program_ = pcl::make_shared(); // TODO: to remove file dependency include the shader source in the binary if (!sum_program_->addShaderFile ("sum_score.vert", gllib::VERTEX)) { diff --git a/simulation/tools/sim_terminal_demo.cpp b/simulation/tools/sim_terminal_demo.cpp index 1e55ff41937..74812838844 100644 --- a/simulation/tools/sim_terminal_demo.cpp +++ b/simulation/tools/sim_terminal_demo.cpp @@ -19,6 +19,7 @@ # include #endif +#include #include "simulation_io.hpp" using namespace Eigen; @@ -131,7 +132,7 @@ main (int argc, char** argv) // 2 Construct the simulation method: int width = 640; int height = 480; - simexample = SimExample::Ptr (new SimExample (argc, argv, height,width )); + simexample = pcl::make_shared(argc, argv, height,width ); // 3 Generate a series of simulation poses: // -0 100 fixed poses diff --git a/simulation/tools/sim_test_performance.cpp b/simulation/tools/sim_test_performance.cpp index 39b26a6d83f..c785d3c99da 100644 --- a/simulation/tools/sim_test_performance.cpp +++ b/simulation/tools/sim_test_performance.cpp @@ -9,6 +9,8 @@ #include #include #include + +#include #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include @@ -357,7 +359,7 @@ loadPolygonMeshModel (char* polygon_file) pcl::io::loadPolygonFile (polygon_file, mesh); pcl::PolygonMesh::Ptr cloud (new pcl::PolygonMesh (mesh)); - TriangleMeshModel::Ptr model = TriangleMeshModel::Ptr (new TriangleMeshModel (cloud)); + TriangleMeshModel::Ptr model = pcl::make_shared(cloud); scene_->add (model); std::cout << "Just read " << polygon_file << std::endl; @@ -431,11 +433,11 @@ main (int argc, char** argv) std::cout << "GL_MAX_VIEWPORTS: " << GL_MAX_VIEWPORTS << std::endl; - camera_ = Camera::Ptr (new Camera ()); - scene_ = Scene::Ptr (new Scene ()); + camera_ = pcl::make_shared(); + scene_ = pcl::make_shared(); - range_likelihood_visualization_ = RangeLikelihood::Ptr (new RangeLikelihood (1, 1, height, width, scene_)); - range_likelihood_ = RangeLikelihood::Ptr (new RangeLikelihood (rows, cols, row_height, col_width, scene_)); + range_likelihood_visualization_ = pcl::make_shared(1, 1, height, width, scene_); + range_likelihood_ = pcl::make_shared(rows, cols, row_height, col_width, scene_); // Actually corresponds to default parameters: range_likelihood_visualization_->setCameraIntrinsicsParameters ( @@ -450,8 +452,8 @@ main (int argc, char** argv) range_likelihood_->setSumOnCPU (false); range_likelihood_->setUseColor (false); - textured_quad_ = TexturedQuad::Ptr (new TexturedQuad (range_likelihood_->getWidth (), - range_likelihood_->getHeight ())); + textured_quad_ = pcl::make_shared(range_likelihood_->getWidth (), + range_likelihood_->getHeight ()); initialize (argc, argv); diff --git a/simulation/tools/sim_test_simple.cpp b/simulation/tools/sim_test_simple.cpp index 21e2be72c8b..31179c22bc1 100644 --- a/simulation/tools/sim_test_simple.cpp +++ b/simulation/tools/sim_test_simple.cpp @@ -56,10 +56,11 @@ #define VTK_EXCLUDE_STRSTREAM_HEADERS #include +#include #include "pcl/simulation/camera.h" #include "pcl/simulation/model.h" -#include "pcl/simulation/scene.h" #include "pcl/simulation/range_likelihood.h" +#include "pcl/simulation/scene.h" #include #include @@ -542,7 +543,7 @@ void load_PolygonMesh_model (char* polygon_file) // Not sure if PolygonMesh assumes triangles if to // TODO: Ask a developer - PolygonMeshModel::Ptr model = PolygonMeshModel::Ptr (new PolygonMeshModel (GL_POLYGON, cloud)); + PolygonMeshModel::Ptr model = pcl::make_shared(GL_POLYGON, cloud); scene_->add (model); std::cout << "Just read " << polygon_file << std::endl; @@ -623,12 +624,12 @@ main (int argc, char** argv) } std::cout << "GL_MAX_VIEWPORTS: " << GL_MAX_VIEWPORTS << std::endl; - camera_ = Camera::Ptr (new Camera ()); - scene_ = Scene::Ptr (new Scene ()); + camera_ = pcl::make_shared(); + scene_ = pcl::make_shared(); //range_likelihood_ = RangeLikelihoodGLSL::Ptr(new RangeLikelihoodGLSL(1, 1, height, width, scene_, 0)); - range_likelihood_ = RangeLikelihood::Ptr (new RangeLikelihood (2, 2, height/2, width/2, scene_)); + range_likelihood_ = pcl::make_shared(2, 2, height/2, width/2, scene_); // range_likelihood_ = RangeLikelihood::Ptr(new RangeLikelihood(10, 10, 96, 96, scene_)); // range_likelihood_ = RangeLikelihood::Ptr(new RangeLikelihood(1, 1, 480, 640, scene_)); diff --git a/simulation/tools/sim_viewer.cpp b/simulation/tools/sim_viewer.cpp index 0c679e7db48..133c1ee2cb6 100644 --- a/simulation/tools/sim_viewer.cpp +++ b/simulation/tools/sim_viewer.cpp @@ -70,10 +70,11 @@ #define VTK_EXCLUDE_STRSTREAM_HEADERS #include +#include #include "pcl/simulation/camera.h" #include "pcl/simulation/model.h" -#include "pcl/simulation/scene.h" #include "pcl/simulation/range_likelihood.h" +#include "pcl/simulation/scene.h" #include #include @@ -411,7 +412,7 @@ loadPolygonMeshModel (char* polygon_file) // Not sure if PolygonMesh assumes triangles if to // TODO: Ask a developer //PolygonMeshModel::Ptr model = PolygonMeshModel::Ptr (new PolygonMeshModel (GL_POLYGON, cloud)); - TriangleMeshModel::Ptr model = TriangleMeshModel::Ptr (new TriangleMeshModel (cloud)); + TriangleMeshModel::Ptr model = pcl::make_shared(cloud); scene_->add (model); std::cout << "Just read " << polygon_file << std::endl; @@ -545,7 +546,7 @@ main (int argc, char** argv) // Create the PCLVisualizer object here on the first encountered XYZ file if (!p) - p.reset (new pcl::visualization::PCLVisualizer (argc, argv, "PCD viewer")); + p = pcl::make_shared (argc, argv, "PCD viewer"); // Multiview enabled? if (mview) @@ -581,7 +582,7 @@ main (int argc, char** argv) // Go through PCD files for (size_t i = 0; i < p_file_indices.size (); ++i) { - cloud.reset (new pcl::PCLPointCloud2); + cloud = pcl::make_shared (); Eigen::Vector4f origin; Eigen::Quaternionf orientation; int version; @@ -600,7 +601,7 @@ main (int argc, char** argv) cloud_name << argv[p_file_indices.at (i)]; if (!ph) - ph.reset (new pcl::visualization::PCLHistogramVisualizer); + ph = pcl::make_shared (); print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", cloud->fields[0].count); print_info (" points]\n"); pcl::getMinMax (*cloud, 0, cloud->fields[0].name, min_p, max_p); @@ -613,7 +614,7 @@ main (int argc, char** argv) // Create the PCLVisualizer object here on the first encountered XYZ file if (!p) { - p.reset (new pcl::visualization::PCLVisualizer (argc, argv, "PCD viewer")); + p = pcl::make_shared (argc, argv, "PCD viewer"); p->registerPointPickingCallback (&pp_callback, (void*)&cloud); Eigen::Matrix3f rotation; rotation = orientation; @@ -646,15 +647,15 @@ main (int argc, char** argv) if (fcolorparam) { if (fcolor_r.size () > i && fcolor_g.size () > i && fcolor_b.size () > i) - color_handler.reset (new pcl::visualization::PointCloudColorHandlerCustom (cloud, fcolor_r[i], fcolor_g[i], fcolor_b[i])); + color_handler = pcl::make_shared> (cloud, fcolor_r[i], fcolor_g[i], fcolor_b[i]); else - color_handler.reset (new pcl::visualization::PointCloudColorHandlerRandom (cloud)); + color_handler = pcl::make_shared> (cloud); } else - color_handler.reset (new pcl::visualization::PointCloudColorHandlerRandom (cloud)); + color_handler = pcl::make_shared> (cloud); // Add the dataset with a XYZ and a random handler - geometry_handler.reset (new pcl::visualization::PointCloudGeometryHandlerXYZ (cloud)); + geometry_handler = pcl::make_shared> (cloud); // Add the cloud to the renderer //p->addPointCloud (cloud_xyz, geometry_handler, color_handler, cloud_name.str (), viewport); p->addPointCloud (cloud, geometry_handler, color_handler, origin, orientation, cloud_name.str (), viewport); @@ -730,12 +731,12 @@ main (int argc, char** argv) for (size_t f = 0; f < cloud->fields.size (); ++f) { if (cloud->fields[f].name == "rgb" || cloud->fields[f].name == "rgba") - color_handler.reset (new pcl::visualization::PointCloudColorHandlerRGBField (cloud)); + color_handler = pcl::make_shared> (cloud); else { if (!isValidFieldName (cloud->fields[f].name)) continue; - color_handler.reset (new pcl::visualization::PointCloudColorHandlerGenericField (cloud, cloud->fields[f].name)); + color_handler = pcl::make_shared> (cloud, cloud->fields[f].name); } // Add the cloud to the renderer //p->addPointCloud (cloud_xyz, color_handler, cloud_name.str (), viewport); @@ -743,7 +744,7 @@ main (int argc, char** argv) } } // Additionally, add normals as a handler - geometry_handler.reset (new pcl::visualization::PointCloudGeometryHandlerSurfaceNormal (cloud)); + geometry_handler = pcl::make_shared> (cloud); if (geometry_handler->isCapable ()) //p->addPointCloud (cloud_xyz, geometry_handler, cloud_name.str (), viewport); p->addPointCloud (cloud, geometry_handler, origin, orientation, cloud_name.str (), viewport); @@ -805,10 +806,10 @@ main (int argc, char** argv) } - camera_ = Camera::Ptr (new Camera ()); - scene_ = Scene::Ptr (new Scene ()); + camera_ = pcl::make_shared(); + scene_ = pcl::make_shared(); - range_likelihood_ = RangeLikelihood::Ptr (new RangeLikelihood(1, 1, height, width, scene_)); + range_likelihood_ = pcl::make_shared(1, 1, height, width, scene_); // range_likelihood_ = RangeLikelihood::Ptr(new RangeLikelihood(10, 10, 96, 96, scene_)); // range_likelihood_ = RangeLikelihood::Ptr(new RangeLikelihood(1, 1, 480, 640, scene_)); diff --git a/simulation/tools/simulation_io.cpp b/simulation/tools/simulation_io.cpp index a8d653e2f40..b463d706dc1 100644 --- a/simulation/tools/simulation_io.cpp +++ b/simulation/tools/simulation_io.cpp @@ -1,6 +1,8 @@ #include "simulation_io.hpp" #include +#include + pcl::simulation::SimExample::SimExample(int argc, char** argv, @@ -10,11 +12,11 @@ pcl::simulation::SimExample::SimExample(int argc, char** argv, initializeGL (argc, argv); // 1. construct member elements: - camera_ = Camera::Ptr (new Camera ()); - scene_ = Scene::Ptr (new Scene ()); + camera_ = pcl::make_shared(); + scene_ = pcl::make_shared(); //rl_ = RangeLikelihoodGLSL::Ptr(new RangeLikelihoodGLSL(1, 1, height, width, scene_, 0)); - rl_ = RangeLikelihood::Ptr (new RangeLikelihood (1, 1, height, width, scene_)); + rl_ = pcl::make_shared(1, 1, height, width, scene_); // rl_ = RangeLikelihood::Ptr(new RangeLikelihood(10, 10, 96, 96, scene_)); // rl_ = RangeLikelihood::Ptr(new RangeLikelihood(1, 1, height_, width_, scene_)); @@ -32,7 +34,7 @@ pcl::simulation::SimExample::SimExample(int argc, char** argv, pcl::PolygonMesh::Ptr cloud (new pcl::PolygonMesh (mesh)); // Not sure if PolygonMesh assumes triangles if to, TODO: Ask a developer - PolygonMeshModel::Ptr model = PolygonMeshModel::Ptr (new PolygonMeshModel (GL_POLYGON, cloud)); + PolygonMeshModel::Ptr model = pcl::make_shared(GL_POLYGON, cloud); scene_->add (model); std::cout << "Just read " << argv[2] << std::endl; diff --git a/surface/src/ear_clipping.cpp b/surface/src/ear_clipping.cpp index 50a6046988e..dfbb5ef6682 100644 --- a/surface/src/ear_clipping.cpp +++ b/surface/src/ear_clipping.cpp @@ -39,11 +39,13 @@ #include #include +#include + ///////////////////////////////////////////////////////////////////////////////////////////// bool pcl::EarClipping::initCompute () { - points_.reset (new pcl::PointCloud); + points_ = pcl::make_shared> (); if (!MeshProcessing::initCompute ()) return (false); diff --git a/test/features/test_base_feature.cpp b/test/features/test_base_feature.cpp index 877eaf42756..fc175133dae 100644 --- a/test/features/test_base_feature.cpp +++ b/test/features/test_base_feature.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -172,7 +174,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_board_estimation.cpp b/test/features/test_board_estimation.cpp index d61ad556c33..56af776ab8c 100644 --- a/test/features/test_board_estimation.cpp +++ b/test/features/test_board_estimation.cpp @@ -44,6 +44,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::test; using namespace pcl::io; @@ -163,7 +165,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_boundary_estimation.cpp b/test/features/test_boundary_estimation.cpp index e3033c29f2d..aac346a203a 100644 --- a/test/features/test_boundary_estimation.cpp +++ b/test/features/test_boundary_estimation.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -149,7 +151,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_brisk.cpp b/test/features/test_brisk.cpp index 0d02f55612b..43bea5ccf3b 100644 --- a/test/features/test_brisk.cpp +++ b/test/features/test_brisk.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -67,7 +69,7 @@ TEST (PCL, BRISK_2D) brisk_keypoint_estimation.setOctaves (4); brisk_keypoint_estimation.setInputCloud (cloud_image); - cloud_keypoints.reset (new PointCloud); + cloud_keypoints = pcl::make_shared> (); brisk_keypoint_estimation.compute (*cloud_keypoints); //io::savePCDFileBinary ("brisk_keypoints.pcd", *cloud_keypoints); @@ -95,7 +97,7 @@ TEST (PCL, BRISK_2D) brisk_descriptor_estimation.setKeypoints (cloud_keypoints); - cloud_descriptors.reset (new PointCloud); + cloud_descriptors = pcl::make_shared> (); brisk_descriptor_estimation.compute (*cloud_descriptors); const int num_of_descriptors = int (cloud_descriptors->size ()); diff --git a/test/features/test_curvatures_estimation.cpp b/test/features/test_curvatures_estimation.cpp index db5c35596d6..280081a3374 100644 --- a/test/features/test_curvatures_estimation.cpp +++ b/test/features/test_curvatures_estimation.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -163,7 +165,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_cvfh_estimation.cpp b/test/features/test_cvfh_estimation.cpp index 2cd16d4d1e3..d1927af8301 100644 --- a/test/features/test_cvfh_estimation.cpp +++ b/test/features/test_cvfh_estimation.cpp @@ -44,6 +44,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -148,17 +150,17 @@ main (int argc, char** argv) indices[i] = static_cast(i); } - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); - cloud_milk.reset(new PointCloud()); + cloud_milk = pcl::make_shared>(); CloudPtr grid; pcl::VoxelGrid < pcl::PointXYZ > grid_; grid_.setInputCloud (milk_loaded); grid_.setLeafSize (leaf_size_, leaf_size_, leaf_size_); grid_.filter (*cloud_milk); - tree_milk.reset (new search::KdTree (false)); + tree_milk = pcl::make_shared> (false); tree_milk->setInputCloud (cloud_milk); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_flare_estimation.cpp b/test/features/test_flare_estimation.cpp index a389b4b2156..f2ca7001aa1 100644 --- a/test/features/test_flare_estimation.cpp +++ b/test/features/test_flare_estimation.cpp @@ -44,6 +44,8 @@ #include #include +#include + using KdTreePtr = pcl::search::KdTree::Ptr; using PointCloudPtr = pcl::PointCloud::Ptr; @@ -147,7 +149,7 @@ main (int argc, char** argv) return (-1); } - cloud.reset (new pcl::PointCloud ()); + cloud = pcl::make_shared> (); if (pcl::io::loadPCDFile (argv[1], *cloud) < 0) { @@ -155,21 +157,21 @@ main (int argc, char** argv) return (-1); } - tree.reset (new pcl::search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); //create and set sampled point cloud for computation of X axis const float sampling_perc = 0.2f; const float sampling_incr = 1.0f / sampling_perc; - sampled_cloud.reset (new pcl::PointCloud ()); + sampled_cloud = pcl::make_shared> (); std::vector sampled_indices; for (float sa = 0.0f; sa < (float)cloud->points.size (); sa += sampling_incr) sampled_indices.push_back (static_cast (sa)); copyPointCloud (*cloud, sampled_indices, *sampled_cloud); - sampled_tree.reset (new pcl::search::KdTree (false)); + sampled_tree = pcl::make_shared> (false); sampled_tree->setInputCloud (sampled_cloud); //start tests diff --git a/test/features/test_gasd_estimation.cpp b/test/features/test_gasd_estimation.cpp index 17c133e40a0..8032b6e9d6f 100644 --- a/test/features/test_gasd_estimation.cpp +++ b/test/features/test_gasd_estimation.cpp @@ -41,6 +41,8 @@ #include #include +#include + pcl::PointCloud::Ptr cloud; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -321,7 +323,7 @@ main (int argc, return (-1); } - cloud.reset (new pcl::PointCloud); + cloud = pcl::make_shared> (); if (pcl::io::loadPCDFile < pcl::PointXYZ > (argv[1], *cloud) < 0) { diff --git a/test/features/test_ii_normals.cpp b/test/features/test_ii_normals.cpp index c617f4ec604..263ead31dea 100644 --- a/test/features/test_ii_normals.cpp +++ b/test/features/test_ii_normals.cpp @@ -43,6 +43,8 @@ #include +#include + using namespace pcl; using namespace std; @@ -345,7 +347,7 @@ TEST(PCL, IntegralImage3D) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, NormalEstimation) { - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); n.setSearchMethod (tree); n.setKSearch (10); diff --git a/test/features/test_invariants_estimation.cpp b/test/features/test_invariants_estimation.cpp index 7d166320f3e..cb966305394 100644 --- a/test/features/test_invariants_estimation.cpp +++ b/test/features/test_invariants_estimation.cpp @@ -42,6 +42,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -113,7 +115,7 @@ main (int argc, char** argv) for (int i = 0; i < static_cast (indices.size ()); ++i) indices[i] = i; - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_normal_estimation.cpp b/test/features/test_normal_estimation.cpp index 1d3907cb9f0..615e7c7c45e 100644 --- a/test/features/test_normal_estimation.cpp +++ b/test/features/test_normal_estimation.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -166,7 +168,7 @@ TEST (PCL, NormalEstimation) EXPECT_EQ (n.getSearchSurface (), surfaceptr); // Additional test for searchForNeigbhors - surfaceptr.reset (new PointCloud); + surfaceptr = pcl::make_shared> (); *surfaceptr = *cloudptr; surfaceptr->points.resize (640 * 480); surfaceptr->width = 640; @@ -233,7 +235,7 @@ main (int argc, char** argv) for (int i = 0; i < static_cast (indices.size ()); ++i) indices[i] = i; - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_pfh_estimation.cpp b/test/features/test_pfh_estimation.cpp index dbf61335e37..9f62c62db55 100644 --- a/test/features/test_pfh_estimation.cpp +++ b/test/features/test_pfh_estimation.cpp @@ -51,6 +51,8 @@ #include #include +#include + using PointT = pcl::PointNormal; using KdTreePtr = pcl::search::KdTree::Ptr; using pcl::PointCloud; @@ -120,7 +122,7 @@ testIndicesAndSearchSurface (const typename PointCloud::Ptr & points, // PointCloud output3, output4; - pcl::IndicesPtr indices2 (new pcl::Indices (0)); + pcl::IndicesPtr indices2 = pcl::make_shared (0); for (size_t i = 0; i < (indices->size ()/2); ++i) indices2->push_back (static_cast (i)); @@ -204,7 +206,7 @@ TEST (PCL, PFHEstimation) // Object PointCloud::Ptr pfhs (new PointCloud ()); - pcl::IndicesPtr indicesptr (new pcl::Indices (indices)); + pcl::IndicesPtr indicesptr = pcl::make_shared (indices); // set parameters pfh.setInputCloud (cloud); @@ -251,7 +253,7 @@ TEST (PCL, PFHEstimation) // Test results when setIndices and/or setSearchSurface are used - pcl::IndicesPtr test_indices (new pcl::Indices (0)); + pcl::IndicesPtr test_indices = pcl::make_shared (0); for (size_t i = 0; i < cloud->size (); i+=3) test_indices->push_back (static_cast (i)); @@ -391,7 +393,7 @@ TYPED_TEST (FPFHTest, Estimation) // Object PointCloud::Ptr fpfhs (new PointCloud ()); - pcl::IndicesPtr indicesptr (new pcl::Indices (indices)); + pcl::IndicesPtr indicesptr = pcl::make_shared (indices); // set parameters fpfh.setInputCloud (cloud); @@ -440,7 +442,7 @@ TYPED_TEST (FPFHTest, Estimation) // Test results when setIndices and/or setSearchSurface are used - pcl::IndicesPtr test_indices (new pcl::Indices (0)); + pcl::IndicesPtr test_indices = pcl::make_shared (0); for (size_t i = 0; i < cloud->size (); i+=3) test_indices->push_back (static_cast (i)); @@ -457,7 +459,7 @@ TEST (PCL, VFHEstimation) // Object pcl::VFHEstimation vfh; PointCloud::Ptr vfhs (new PointCloud ()); - pcl::IndicesPtr indicesptr (new pcl::Indices (indices)); + pcl::IndicesPtr indicesptr = pcl::make_shared (indices); // set parameters vfh.setInputCloud (cloud); @@ -539,7 +541,7 @@ main (int argc, char** argv) for (size_t i = 0; i < cloud->size (); ++i) indices.push_back (static_cast (i)); - tree.reset (new pcl::search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_ppf_estimation.cpp b/test/features/test_ppf_estimation.cpp index 0ef01b05331..ae173c49801 100644 --- a/test/features/test_ppf_estimation.cpp +++ b/test/features/test_ppf_estimation.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -119,7 +121,7 @@ main (int argc, char** argv) for (int i = 0; i < static_cast (indices.size ()); ++i) indices[i] = i; - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_rops_estimation.cpp b/test/features/test_rops_estimation.cpp index 9b1c81bc480..dd33ec4a422 100644 --- a/test/features/test_rops_estimation.cpp +++ b/test/features/test_rops_estimation.cpp @@ -42,6 +42,8 @@ #include #include +#include + pcl::PointCloud ::Ptr cloud; pcl::PointIndicesPtr indices; std::vector triangles; @@ -135,7 +137,7 @@ main (int argc, char** argv) return (-1); } - indices.reset (new pcl::PointIndices); + indices = pcl::make_shared (); std::ifstream indices_file; indices_file.open (argv[2], std::ifstream::in); for (std::string line; std::getline (indices_file, line);) diff --git a/test/features/test_shot_estimation.cpp b/test/features/test_shot_estimation.cpp index cdf812bf33e..e01fc87e3ad 100644 --- a/test/features/test_shot_estimation.cpp +++ b/test/features/test_shot_estimation.cpp @@ -37,15 +37,16 @@ * */ +#include "pcl/features/shot_lrf.h" +#include #include -#include +#include #include -#include #include #include -#include "pcl/features/shot_lrf.h" -#include #include +#include +#include using namespace pcl; using namespace pcl::io; @@ -579,7 +580,7 @@ TYPED_TEST (SHOTShapeAndColorTest, Estimation) n.compute (*normals); search::KdTree::Ptr rgbaTree; - rgbaTree.reset (new search::KdTree (false)); + rgbaTree = pcl::make_shared> (false); // Create fake point cloud with colors PointCloud cloudWithColors; @@ -843,7 +844,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_shot_lrf_estimation.cpp b/test/features/test_shot_lrf_estimation.cpp index 71165056e8d..f8d3a42d5ea 100644 --- a/test/features/test_shot_lrf_estimation.cpp +++ b/test/features/test_shot_lrf_estimation.cpp @@ -43,6 +43,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::test; using namespace pcl::io; @@ -148,7 +150,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (true)); + tree = pcl::make_shared> (true); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/features/test_spin_estimation.cpp b/test/features/test_spin_estimation.cpp index 15eb9f1c066..4c4ccdb71c5 100644 --- a/test/features/test_spin_estimation.cpp +++ b/test/features/test_spin_estimation.cpp @@ -44,6 +44,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -300,7 +302,7 @@ main (int argc, char** argv) for (size_t i = 0; i < indices.size (); ++i) indices[i] = static_cast (i); - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud.makeShared ()); testing::InitGoogleTest (&argc, argv); diff --git a/test/filters/test_filters.cpp b/test/filters/test_filters.cpp index d051d21a9fb..d5b18f71bb1 100644 --- a/test/filters/test_filters.cpp +++ b/test/filters/test_filters.cpp @@ -39,6 +39,7 @@ */ #include +#include #include #include #include @@ -68,11 +69,11 @@ using namespace std; using namespace Eigen; -PCLPointCloud2::Ptr cloud_blob (new PCLPointCloud2); -PointCloud::Ptr cloud (new PointCloud); +PCLPointCloud2::Ptr cloud_blob = pcl::make_shared (); +PointCloud::Ptr cloud = pcl::make_shared> (); vector indices_; -PointCloud::Ptr cloud_organized (new PointCloud); +PointCloud::Ptr cloud_organized = pcl::make_shared> (); //pcl::IndicesConstPtr indices; @@ -82,11 +83,11 @@ TEST (ExtractIndicesSelf, Filters) { // Test the PointCloud method ExtractIndices ei; - pcl::IndicesPtr indices (new pcl::Indices (2)); + pcl::IndicesPtr indices = pcl::make_shared (2); (*indices)[0] = 0; (*indices)[1] = static_cast (cloud->points.size ()) - 1; - PointCloud::Ptr output (new PointCloud); + PointCloud::Ptr output = pcl::make_shared> (); ei.setInputCloud (cloud); ei.setIndices (indices); ei.filter (*output); @@ -109,7 +110,7 @@ TEST (ExtractIndices, Filters) { // Test the PointCloud method ExtractIndices ei; - pcl::IndicesPtr indices (new pcl::Indices (2)); + pcl::IndicesPtr indices = pcl::make_shared (2); (*indices)[0] = 0; (*indices)[1] = static_cast (cloud->points.size ()) - 1; @@ -230,7 +231,7 @@ TEST (ExtractIndices, Filters) eie.filter (result); EXPECT_EQ (int (result.points.size ()), 0); - pcl::IndicesPtr idx (new pcl::Indices (10)); + pcl::IndicesPtr idx = pcl::make_shared (10); eie.setIndices (idx); eie.setNegative (false); eie.filter (result); @@ -902,8 +903,8 @@ TEST (VoxelGrid_RGB, Filters) } toPCLPointCloud2 (cloud_rgb_, cloud_rgb_blob_); - cloud_rgb_blob_ptr_.reset (new PCLPointCloud2 (cloud_rgb_blob_)); - cloud_rgb_ptr_.reset (new PointCloud (cloud_rgb_)); + cloud_rgb_blob_ptr_ = pcl::make_shared (cloud_rgb_blob_); + cloud_rgb_ptr_ = pcl::make_shared> (cloud_rgb_); PointCloud output_rgb; VoxelGrid grid_rgb; @@ -996,8 +997,8 @@ TEST (VoxelGrid_RGBA, Filters) } toPCLPointCloud2 (cloud_rgba_, cloud_rgba_blob_); - cloud_rgba_blob_ptr_.reset (new PCLPointCloud2 (cloud_rgba_blob_)); - cloud_rgba_ptr_.reset (new PointCloud (cloud_rgba_)); + cloud_rgba_blob_ptr_ = pcl::make_shared (cloud_rgba_blob_); + cloud_rgba_ptr_ = pcl::make_shared> (cloud_rgba_); PointCloud output_rgba; VoxelGrid grid_rgba; @@ -1065,7 +1066,7 @@ TEST (VoxelGrid_XYZNormal, Filters) PCLPointCloud2 cloud_blob_; PCLPointCloud2::Ptr cloud_blob_ptr_; - PointCloud::Ptr input (new PointCloud); + PointCloud::Ptr input = pcl::make_shared> (); PointCloud output; input->reserve (16); input->is_dense = false; @@ -1206,7 +1207,7 @@ TEST (VoxelGrid_XYZNormal, Filters) } toPCLPointCloud2 (*input, cloud_blob_); - cloud_blob_ptr_.reset (new PCLPointCloud2 (cloud_blob_)); + cloud_blob_ptr_ = pcl::make_shared(cloud_blob_); VoxelGrid grid2; PCLPointCloud2 output_blob; @@ -1334,7 +1335,7 @@ TEST (ProjectInliers, Filters) ProjectInliers proj; PointCloud output; - ModelCoefficients::Ptr coefficients (new ModelCoefficients ()); + ModelCoefficients::Ptr coefficients = pcl::make_shared (); coefficients->values.resize (4); coefficients->values[0] = coefficients->values[1] = 0; coefficients->values[2] = 1.0; @@ -1555,19 +1556,11 @@ TEST (ConditionalRemoval, Filters) PointCloud output; // build the condition - ConditionAnd::Ptr range_cond (new ConditionAnd ()); - range_cond->addComparison (FieldComparison::ConstPtr (new FieldComparison ("z", - ComparisonOps::GT, - 0.02))); - range_cond->addComparison (FieldComparison::ConstPtr (new FieldComparison ("z", - ComparisonOps::LT, - 0.04))); - range_cond->addComparison (FieldComparison::ConstPtr (new FieldComparison ("y", - ComparisonOps::GT, - 0.10))); - range_cond->addComparison (FieldComparison::ConstPtr (new FieldComparison ("y", - ComparisonOps::LT, - 0.12))); + ConditionAnd::Ptr range_cond = pcl::make_shared> (); + range_cond->addComparison (pcl::make_shared> ("z", ComparisonOps::GT, 0.02)); + range_cond->addComparison (pcl::make_shared> ("z", ComparisonOps::LT, 0.04)); + range_cond->addComparison (pcl::make_shared> ("y", ComparisonOps::GT, 0.10)); + range_cond->addComparison (pcl::make_shared> ("y", ComparisonOps::LT, 0.12)); // build the filter ConditionalRemoval condrem; @@ -1651,14 +1644,14 @@ TEST (ConditionalRemovalSetIndices, Filters) PointCloud output; // build some indices - pcl::IndicesPtr indices (new pcl::Indices (2)); + pcl::IndicesPtr indices = pcl::make_shared (2); (*indices)[0] = 0; (*indices)[1] = static_cast (cloud->points.size ()) - 1; // build a condition which is always true - ConditionAnd::Ptr true_cond (new ConditionAnd ()); - true_cond->addComparison (TfQuadraticXYZComparison::ConstPtr (new TfQuadraticXYZComparison (ComparisonOps::EQ, Eigen::Matrix3f::Zero (), - Eigen::Vector3f::Zero (), 0))); + ConditionAnd::Ptr true_cond = pcl::make_shared> (); + true_cond->addComparison (pcl::make_shared> (ComparisonOps::EQ, Eigen::Matrix3f::Zero (), + Eigen::Vector3f::Zero (), 0)); // build the filter ConditionalRemoval condrem2; @@ -1764,7 +1757,7 @@ TEST (ConditionalRemovalSetIndices, Filters) ////////////////////////////////////////////////////////////////////////////////////////////// TEST (SamplingSurfaceNormal, Filters) { - PointCloud ::Ptr incloud (new PointCloud ()); + PointCloud ::Ptr incloud = pcl::make_shared> (); PointCloud outcloud; //Creating a point cloud on the XY plane @@ -1800,7 +1793,7 @@ TEST (SamplingSurfaceNormal, Filters) TEST (ShadowPoints, Filters) { //Creating a point cloud on the XY plane - PointCloud::Ptr input (new PointCloud ()); + PointCloud::Ptr input = pcl::make_shared> (); for (float i = 0.0f; i < 10.0f; i+=0.1f) { for (float j = 0.0f; j < 10.0f; j+=0.1f) @@ -1819,10 +1812,10 @@ TEST (ShadowPoints, Filters) NormalEstimation ne; ne.setInputCloud (input); - pcl::search::KdTree::Ptr tree (new pcl::search::KdTree ()); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); ne.setSearchMethod (tree); - pcl::PointCloud::Ptr input_normals (new PointCloud); + pcl::PointCloud::Ptr input_normals = pcl::make_shared> (); ne.setKSearch (15); ne.compute (*input_normals); @@ -1864,7 +1857,7 @@ TEST (ShadowPoints, Filters) TEST (FrustumCulling, Filters) { //Creating a point cloud on the XY plane - PointCloud::Ptr input (new PointCloud ()); + PointCloud::Ptr input = pcl::make_shared> (); for (int i = 0; i < 5; i++) { @@ -1907,7 +1900,7 @@ TEST (FrustumCulling, Filters) fc.setCameraPose (camera_pose); - pcl::PointCloud ::Ptr output (new pcl::PointCloud ); + pcl::PointCloud ::Ptr output = pcl::make_shared> (); fc.filter (*output); // Should filter all points in the input cloud @@ -1944,7 +1937,7 @@ TEST (ConditionalRemovalTfQuadraticXYZComparison, Filters) PointCloud output; // Create cloud: a line along the x-axis - PointCloud::Ptr input (new PointCloud ()); + PointCloud::Ptr input = pcl::make_shared> (); input->push_back (PointXYZ (-1.0, 0.0, 0.0)); input->push_back (PointXYZ (0.0, 0.0, 0.0)); @@ -1958,12 +1951,12 @@ TEST (ConditionalRemovalTfQuadraticXYZComparison, Filters) input->push_back (PointXYZ (8.0, 0.0, 0.0)); // build a condition representing the inner of a cylinder including the edge located at the origin and pointing along the x-axis. - ConditionAnd::Ptr cyl_cond (new ConditionAnd ()); + ConditionAnd::Ptr cyl_cond = pcl::make_shared> (); Eigen::Matrix3f cylinderMatrix; cylinderMatrix << 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0; float cylinderScalar = -4; //radius² of cylinder - TfQuadraticXYZComparison::Ptr cyl_comp (new TfQuadraticXYZComparison (ComparisonOps::LE, cylinderMatrix, - Eigen::Vector3f::Zero (), cylinderScalar)); + TfQuadraticXYZComparison::Ptr cyl_comp = pcl::make_shared> (ComparisonOps::LE, + cylinderMatrix, Eigen::Vector3f::Zero (), cylinderScalar); cyl_cond->addComparison (cyl_comp); // build the filter @@ -2145,6 +2138,7 @@ TEST (MedianFilter, Filters) ////////////////////////////////////////////////////////////////////////////////////////////// #include + TEST (NormalRefinement, Filters) { /* @@ -2216,8 +2210,8 @@ TEST (NormalRefinement, Filters) */ // Calculate SAC model - pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients); - pcl::PointIndices::Ptr inliers (new pcl::PointIndices); + pcl::ModelCoefficients::Ptr coefficients = pcl::make_shared (); + pcl::PointIndices::Ptr inliers = pcl::make_shared (); pcl::SACSegmentation seg; seg.setOptimizeCoefficients (true); seg.setModelType (pcl::SACMODEL_PLANE); diff --git a/test/keypoints/test_iss_3d.cpp b/test/keypoints/test_iss_3d.cpp index 3eb89a18dcc..eedff1ff60b 100644 --- a/test/keypoints/test_iss_3d.cpp +++ b/test/keypoints/test_iss_3d.cpp @@ -40,6 +40,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; @@ -96,7 +98,7 @@ TEST (PCL, ISSKeypoint3D_WBE) EXPECT_NEAR (keypoints.points[i].z, correct_keypoints[i][2], 1e-6); } - tree.reset (new search::KdTree ()); + tree = pcl::make_shared> (); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -150,7 +152,7 @@ TEST (PCL, ISSKeypoint3D_BE) EXPECT_NEAR (keypoints.points[i].z, correct_keypoints[i][2], 1e-6); } - tree.reset (new search::KdTree ()); + tree = pcl::make_shared> (); } //* ---[ */ diff --git a/test/people/test_people_groundBasedPeopleDetectionApp.cpp b/test/people/test_people_groundBasedPeopleDetectionApp.cpp index 641f02941bd..6b7291c6b3e 100644 --- a/test/people/test_people_groundBasedPeopleDetectionApp.cpp +++ b/test/people/test_people_groundBasedPeopleDetectionApp.cpp @@ -52,6 +52,8 @@ #include #include +#include + using PointT = pcl::PointXYZRGB; using PointCloudT = pcl::PointCloud; @@ -112,7 +114,7 @@ int main (int argc, char** argv) return (-1); } - cloud = PointCloudT::Ptr (new PointCloudT); + cloud = pcl::make_shared(); if (pcl::io::loadPCDFile (argv[2], *cloud) < 0) { cerr << "Failed to read test file. Please download `five_people.pcd` and pass its path to the test." << endl; diff --git a/test/recognition/test_recognition_ism.cpp b/test/recognition/test_recognition_ism.cpp index 258ea83f87f..4141fa96e0d 100644 --- a/test/recognition/test_recognition_ism.cpp +++ b/test/recognition/test_recognition_ism.cpp @@ -49,6 +49,8 @@ #include #include +#include + pcl::PointCloud::Ptr training_cloud; pcl::PointCloud::Ptr testing_cloud; pcl::PointCloud::Ptr training_normals; @@ -70,7 +72,7 @@ TEST (ISM, TrainRecognize) fpfh->setRadiusSearch (30.0); pcl::Feature< pcl::PointXYZ, pcl::Histogram<153> >::Ptr feature_estimator(fpfh); - pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal>::ISMModelPtr model (new pcl::features::ISMModel); + pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal>::ISMModelPtr model = pcl::make_shared (); pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal> ism; ism.setFeatureEstimator(feature_estimator); diff --git a/test/registration/test_registration.cpp b/test/registration/test_registration.cpp index 2bb49f52e15..3572647844a 100644 --- a/test/registration/test_registration.cpp +++ b/test/registration/test_registration.cpp @@ -60,6 +60,8 @@ #include // We need Histogram<2> to function, so we'll explicitly add kdtree_flann.hpp here #include + +#include //(pcl::Histogram<2>) using namespace pcl; @@ -214,11 +216,11 @@ TEST (PCL, IterativeClosestPointWithRejectors) reg.setTransformationEpsilon (1e-8); reg.setMaxCorrespondenceDistance (0.15); // Add a median distance rejector - pcl::registration::CorrespondenceRejectorMedianDistance::Ptr rej_med (new pcl::registration::CorrespondenceRejectorMedianDistance); + pcl::registration::CorrespondenceRejectorMedianDistance::Ptr rej_med = pcl::make_shared (); rej_med->setMedianFactor (4.0); reg.addCorrespondenceRejector (rej_med); // Also add a SaC rejector - pcl::registration::CorrespondenceRejectorSampleConsensus::Ptr rej_samp (new pcl::registration::CorrespondenceRejectorSampleConsensus); + pcl::registration::CorrespondenceRejectorSampleConsensus::Ptr rej_samp = pcl::make_shared> (); reg.addCorrespondenceRejector (rej_samp); size_t ntransforms = 10; @@ -232,8 +234,8 @@ TEST (PCL, IterativeClosestPointWithRejectors) sampleRandomTransform (net_transform, 2*M_PI, 10.); PointCloud::ConstPtr source (cloud_source.makeShared ()); - PointCloud::Ptr source_trans (new PointCloud); - PointCloud::Ptr target_trans (new PointCloud); + PointCloud::Ptr source_trans = pcl::make_shared> (); + PointCloud::Ptr target_trans = pcl::make_shared> (); pcl::transformPointCloud (*source, *source_trans, delta_transform.inverse () * net_transform); pcl::transformPointCloud (*source, *target_trans, net_transform); @@ -264,11 +266,11 @@ TEST (PCL, JointIterativeClosestPoint) reg.setTransformationEpsilon (1e-8); reg.setMaxCorrespondenceDistance (0.25); // Making sure the correspondence distance > the max translation // Add a median distance rejector - pcl::registration::CorrespondenceRejectorMedianDistance::Ptr rej_med (new pcl::registration::CorrespondenceRejectorMedianDistance); + pcl::registration::CorrespondenceRejectorMedianDistance::Ptr rej_med = pcl::make_shared (); rej_med->setMedianFactor (8.0); reg.addCorrespondenceRejector (rej_med); // Also add a SaC rejector - pcl::registration::CorrespondenceRejectorSampleConsensus::Ptr rej_samp (new pcl::registration::CorrespondenceRejectorSampleConsensus); + pcl::registration::CorrespondenceRejectorSampleConsensus::Ptr rej_samp = pcl::make_shared> (); reg.addCorrespondenceRejector (rej_samp); size_t ntransforms = 10; @@ -288,8 +290,8 @@ TEST (PCL, JointIterativeClosestPoint) Eigen::Affine3f net_transform; sampleRandomTransform (net_transform, 2*M_PI, 10.); // And apply it to the source and target - PointCloud::Ptr source_trans (new PointCloud); - PointCloud::Ptr target_trans (new PointCloud); + PointCloud::Ptr source_trans = pcl::make_shared> (); + PointCloud::Ptr target_trans = pcl::make_shared> (); pcl::transformPointCloud (*source, *source_trans, delta_transform.inverse () * net_transform); pcl::transformPointCloud (*source, *target_trans, net_transform); // Add these to the joint solver @@ -316,9 +318,9 @@ TEST (PCL, JointIterativeClosestPoint) TEST (PCL, IterativeClosestPointNonLinear) { using PointT = PointXYZRGB; - PointCloud::Ptr temp_src (new PointCloud); + PointCloud::Ptr temp_src = pcl::make_shared> (); copyPointCloud (cloud_source, *temp_src); - PointCloud::Ptr temp_tgt (new PointCloud); + PointCloud::Ptr temp_tgt = pcl::make_shared> (); copyPointCloud (cloud_target, *temp_tgt); PointCloud output; @@ -364,13 +366,13 @@ TEST (PCL, IterativeClosestPointNonLinear) { bool force_cache = static_cast (iter / 2); bool force_cache_reciprocal = static_cast (iter % 2); - pcl::search::KdTree::Ptr tree(new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); // Ensure that, when force_cache is not set, we are robust to the wrong input if (force_cache) tree->setInputCloud (temp_tgt); reg.setSearchMethodTarget (tree, force_cache); - pcl::search::KdTree::Ptr tree_recip (new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree_recip = pcl::make_shared> (); if (force_cache_reciprocal) tree_recip->setInputCloud (temp_src); reg.setSearchMethodSource (tree_recip, force_cache_reciprocal); @@ -387,9 +389,9 @@ TEST (PCL, IterativeClosestPointNonLinear) TEST (PCL, IterativeClosestPoint_PointToPlane) { using PointT = PointNormal; - PointCloud::Ptr src (new PointCloud); + PointCloud::Ptr src = pcl::make_shared> (); copyPointCloud (cloud_source, *src); - PointCloud::Ptr tgt (new PointCloud); + PointCloud::Ptr tgt = pcl::make_shared> (); copyPointCloud (cloud_target, *tgt); PointCloud output; @@ -401,17 +403,17 @@ TEST (PCL, IterativeClosestPoint_PointToPlane) IterativeClosestPoint reg; using PointToPlane = registration::TransformationEstimationPointToPlane; - PointToPlane::Ptr point_to_plane (new PointToPlane); + PointToPlane::Ptr point_to_plane = pcl::make_shared (); reg.setTransformationEstimation (point_to_plane); reg.setInputSource (src); reg.setInputTarget (tgt); reg.setMaximumIterations (50); reg.setTransformationEpsilon (1e-8); // Use a correspondence estimator which needs normals - registration::CorrespondenceEstimationNormalShooting::Ptr ce (new registration::CorrespondenceEstimationNormalShooting); + registration::CorrespondenceEstimationNormalShooting::Ptr ce = pcl::make_shared> (); reg.setCorrespondenceEstimation (ce); // Add rejector - registration::CorrespondenceRejectorSurfaceNormal::Ptr rej (new registration::CorrespondenceRejectorSurfaceNormal); + registration::CorrespondenceRejectorSurfaceNormal::Ptr rej = pcl::make_shared (); rej->setThreshold (0); //Could be a lot of rotation -- just make sure they're at least within 0 degrees reg.addCorrespondenceRejector (rej); @@ -425,13 +427,13 @@ TEST (PCL, IterativeClosestPoint_PointToPlane) { bool force_cache = (bool) iter/2; bool force_cache_reciprocal = (bool) iter%2; - pcl::search::KdTree::Ptr tree(new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); // Ensure that, when force_cache is not set, we are robust to the wrong input if (force_cache) tree->setInputCloud (tgt); reg.setSearchMethodTarget (tree, force_cache); - pcl::search::KdTree::Ptr tree_recip (new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree_recip = pcl::make_shared> (); if (force_cache_reciprocal) tree_recip->setInputCloud (src); reg.setSearchMethodSource (tree_recip, force_cache_reciprocal); @@ -476,9 +478,9 @@ TEST (PCL, IterativeClosestPoint_PointToPlane) TEST (PCL, GeneralizedIterativeClosestPoint) { using PointT = PointXYZ; - PointCloud::Ptr src (new PointCloud); + PointCloud::Ptr src = pcl::make_shared> (); copyPointCloud (cloud_source, *src); - PointCloud::Ptr tgt (new PointCloud); + PointCloud::Ptr tgt = pcl::make_shared> (); copyPointCloud (cloud_target, *tgt); PointCloud output; @@ -498,13 +500,13 @@ TEST (PCL, GeneralizedIterativeClosestPoint) { bool force_cache = (bool) iter/2; bool force_cache_reciprocal = (bool) iter%2; - pcl::search::KdTree::Ptr tree(new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); // Ensure that, when force_cache is not set, we are robust to the wrong input if (force_cache) tree->setInputCloud (tgt); reg.setSearchMethodTarget (tree, force_cache); - pcl::search::KdTree::Ptr tree_recip (new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree_recip = pcl::make_shared> (); if (force_cache_reciprocal) tree_recip->setInputCloud (src); reg.setSearchMethodSource (tree_recip, force_cache_reciprocal); @@ -520,7 +522,7 @@ TEST (PCL, GeneralizedIterativeClosestPoint) * Eigen::AngleAxisf (0.50 * M_PI, Eigen::Vector3f::UnitY ()) * Eigen::AngleAxisf (0.33 * M_PI, Eigen::Vector3f::UnitZ ())); transform.translation () = Eigen::Vector3f (0.1, 0.2, 0.3); - PointCloud::Ptr transformed_tgt (new PointCloud); + PointCloud::Ptr transformed_tgt = pcl::make_shared> (); pcl::transformPointCloud (*tgt, *transformed_tgt, transform.matrix ()); // transformed_tgt is now a copy of tgt with a transformation matrix applied GeneralizedIterativeClosestPoint reg_guess; @@ -538,16 +540,16 @@ TEST (PCL, GeneralizedIterativeClosestPoint6D) { using PointT = PointXYZRGBA; Eigen::Affine3f delta_transform; - PointCloud::Ptr src_full (new PointCloud); + PointCloud::Ptr src_full = pcl::make_shared> (); copyPointCloud (cloud_with_color, *src_full); - PointCloud::Ptr tgt_full (new PointCloud); + PointCloud::Ptr tgt_full = pcl::make_shared> (); sampleRandomTransform (delta_transform, M_PI/0.1, .03); pcl::transformPointCloud (cloud_with_color, *tgt_full, delta_transform); PointCloud output; // VoxelGrid filter - PointCloud::Ptr src (new PointCloud); - PointCloud::Ptr tgt (new PointCloud); + PointCloud::Ptr src = pcl::make_shared> (); + PointCloud::Ptr tgt = pcl::make_shared> (); pcl::VoxelGrid sor; sor.setLeafSize (0.02f, 0.02f, 0.02f); sor.setInputCloud (src_full); @@ -571,13 +573,13 @@ TEST (PCL, GeneralizedIterativeClosestPoint6D) { bool force_cache = (bool) iter/2; bool force_cache_reciprocal = (bool) iter%2; - pcl::search::KdTree::Ptr tree(new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree = pcl::make_shared> (); // Ensure that, when force_cache is not set, we are robust to the wrong input if (force_cache) tree->setInputCloud (tgt); reg.setSearchMethodTarget (tree, force_cache); - pcl::search::KdTree::Ptr tree_recip (new pcl::search::KdTree); + pcl::search::KdTree::Ptr tree_recip = pcl::make_shared> (); if (force_cache_reciprocal) tree_recip->setInputCloud (src); reg.setSearchMethodSource (tree_recip, force_cache_reciprocal); @@ -597,9 +599,9 @@ TEST (PCL, PyramidFeatureHistogram) PointCloud::Ptr cloud_source_ptr = cloud_source.makeShared (), cloud_target_ptr = cloud_target.makeShared (); - PointCloud::Ptr cloud_source_normals (new PointCloud ()), - cloud_target_normals (new PointCloud ()); - search::KdTree::Ptr tree (new search::KdTree); + PointCloud::Ptr cloud_source_normals = pcl::make_shared> (), + cloud_target_normals = pcl::make_shared> (); + search::KdTree::Ptr tree = pcl::make_shared> (); NormalEstimation normal_estimator; normal_estimator.setSearchMethod (tree); normal_estimator.setRadiusSearch (0.05); @@ -610,8 +612,8 @@ TEST (PCL, PyramidFeatureHistogram) normal_estimator.compute (*cloud_target_normals); - PointCloud::Ptr ppf_signature_source (new PointCloud ()), - ppf_signature_target (new PointCloud ()); + PointCloud::Ptr ppf_signature_source = pcl::make_shared> (), + ppf_signature_target = pcl::make_shared> (); PPFEstimation ppf_estimator; ppf_estimator.setInputCloud (cloud_source_ptr); ppf_estimator.setInputNormals (cloud_source_normals); @@ -629,8 +631,8 @@ TEST (PCL, PyramidFeatureHistogram) dim_range_target.emplace_back(0.0f, 50.0f); - PyramidFeatureHistogram::Ptr pyramid_source (new PyramidFeatureHistogram ()), - pyramid_target (new PyramidFeatureHistogram ()); + PyramidFeatureHistogram::Ptr pyramid_source = pcl::make_shared> (), + pyramid_target = pcl::make_shared> (); pyramid_source->setInputCloud (ppf_signature_source); pyramid_source->setInputDimensionRange (dim_range_input); pyramid_source->setTargetDimensionRange (dim_range_target); @@ -693,32 +695,31 @@ TEST (PCL, PPFRegistration) // Estimate normals for both clouds NormalEstimation normal_estimation; - search::KdTree::Ptr search_tree (new search::KdTree ()); + search::KdTree::Ptr search_tree = pcl::make_shared> (); normal_estimation.setSearchMethod (search_tree); normal_estimation.setRadiusSearch (0.05); - PointCloud::Ptr normals_target (new PointCloud ()), - normals_source_transformed (new PointCloud ()); + PointCloud::Ptr normals_target = pcl::make_shared> (), + normals_source_transformed = pcl::make_shared> (); normal_estimation.setInputCloud (cloud_target_ptr); normal_estimation.compute (*normals_target); normal_estimation.setInputCloud (cloud_source_transformed_ptr); normal_estimation.compute (*normals_source_transformed); - PointCloud::Ptr cloud_target_with_normals (new PointCloud ()), - cloud_source_transformed_with_normals (new PointCloud ()); + PointCloud::Ptr cloud_target_with_normals = pcl::make_shared> (), + cloud_source_transformed_with_normals = pcl::make_shared> (); concatenateFields (*cloud_target_ptr, *normals_target, *cloud_target_with_normals); concatenateFields (*cloud_source_transformed_ptr, *normals_source_transformed, *cloud_source_transformed_with_normals); // Compute PPFSignature feature clouds for source cloud PPFEstimation ppf_estimator; - PointCloud::Ptr features_source_transformed (new PointCloud ()); + PointCloud::Ptr features_source_transformed = pcl::make_shared> (); ppf_estimator.setInputCloud (cloud_source_transformed_ptr); ppf_estimator.setInputNormals (normals_source_transformed); ppf_estimator.compute (*features_source_transformed); // Train the source cloud - create the hash map search structure - PPFHashMapSearch::Ptr hash_map_search (new PPFHashMapSearch (15.0 / 180 * M_PI, - 0.05)); + PPFHashMapSearch::Ptr hash_map_search = pcl::make_shared (15.0 / 180 * M_PI, 0.05); hash_map_search->setInputFeatureCloud (features_source_transformed); // Finally, do the registration @@ -789,4 +790,4 @@ main (int argc, char** argv) // cloud_model.points[i].z += 1; }*/ } -/* ]--- */ \ No newline at end of file +/* ]--- */ diff --git a/test/registration/test_registration_api.cpp b/test/registration/test_registration_api.cpp index f45865dd01f..7c0c44d7113 100644 --- a/test/registration/test_registration_api.cpp +++ b/test/registration/test_registration_api.cpp @@ -60,6 +60,7 @@ #include #include +#include #include "test_registration_api_data.h" using PointXYZ = pcl::PointXYZ; @@ -77,10 +78,10 @@ CloudXYZ cloud_source, cloud_target, cloud_reg; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceEstimation) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); @@ -101,10 +102,10 @@ TEST (PCL, CorrespondenceEstimation) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceEstimationReciprocal) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); @@ -125,17 +126,17 @@ TEST (PCL, CorrespondenceEstimationReciprocal) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorDistance) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); - pcl::CorrespondencesPtr correspondences_result_rej_dist (new pcl::Correspondences); +pcl::CorrespondencesPtr correspondences_result_rej_dist = pcl::make_shared (); pcl::registration::CorrespondenceRejectorDistance corr_rej_dist; corr_rej_dist.setInputCorrespondences (correspondences); corr_rej_dist.setMaximumDistance (rej_dist_max_dist); @@ -156,17 +157,17 @@ TEST (PCL, CorrespondenceRejectorDistance) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorMedianDistance) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); - pcl::CorrespondencesPtr correspondences_result_rej_median_dist (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences_result_rej_median_dist = pcl::make_shared (); pcl::registration::CorrespondenceRejectorMedianDistance corr_rej_median_dist; corr_rej_median_dist.setInputCorrespondences(correspondences); corr_rej_median_dist.setMedianFactor (rej_median_factor); @@ -189,17 +190,17 @@ TEST (PCL, CorrespondenceRejectorMedianDistance) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorOneToOne) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); - pcl::CorrespondencesPtr correspondences_result_rej_one_to_one (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences_result_rej_one_to_one = pcl::make_shared (); pcl::registration::CorrespondenceRejectorOneToOne corr_rej_one_to_one; corr_rej_one_to_one.setInputCorrespondences(correspondences); corr_rej_one_to_one.getCorrespondences(*correspondences_result_rej_one_to_one); @@ -219,18 +220,18 @@ TEST (PCL, CorrespondenceRejectorOneToOne) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorSampleConsensus) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); EXPECT_EQ (int (correspondences->size ()), nr_original_correspondences); - pcl::CorrespondencesPtr correspondences_result_rej_sac (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences_result_rej_sac = pcl::make_shared (); pcl::registration::CorrespondenceRejectorSampleConsensus corr_rej_sac; corr_rej_sac.setInputSource (source); corr_rej_sac.setInputTarget (target); @@ -260,30 +261,30 @@ TEST (PCL, CorrespondenceRejectorSampleConsensus) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorSurfaceNormal) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); - CloudNormalPtr source_normals (new CloudNormal ()); + CloudNormalPtr source_normals = pcl::make_shared (); pcl::copyPointCloud (*source, *source_normals); - CloudNormalPtr target_normals (new CloudNormal ()); + CloudNormalPtr target_normals = pcl::make_shared (); pcl::copyPointCloud (*target, *target_normals); pcl::NormalEstimation norm_est_src; - norm_est_src.setSearchMethod (pcl::search::KdTree::Ptr (new pcl::search::KdTree)); + norm_est_src.setSearchMethod (pcl::make_shared> ()); norm_est_src.setKSearch (10); norm_est_src.setInputCloud (source_normals); norm_est_src.compute (*source_normals); pcl::NormalEstimation norm_est_tgt; - norm_est_tgt.setSearchMethod (pcl::search::KdTree::Ptr (new pcl::search::KdTree)); + norm_est_tgt.setSearchMethod (pcl::make_shared> ()); norm_est_tgt.setKSearch (10); norm_est_tgt.setInputCloud (target_normals); norm_est_tgt.compute (*target_normals); @@ -295,7 +296,7 @@ TEST (PCL, CorrespondenceRejectorSurfaceNormal) corr_rej_surf_norm.setInputNormals (source_normals); corr_rej_surf_norm.setTargetNormals (target_normals); - pcl::CorrespondencesPtr correspondences_result_rej_surf_norm (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences_result_rej_surf_norm = pcl::make_shared (); corr_rej_surf_norm.setInputCorrespondences (correspondences); corr_rej_surf_norm.setThreshold (0.5); @@ -314,17 +315,17 @@ TEST (PCL, CorrespondenceRejectorSurfaceNormal) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorTrimmed) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); - pcl::CorrespondencesPtr correspondences_result_rej_trimmed (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences_result_rej_trimmed = pcl::make_shared (); pcl::registration::CorrespondenceRejectorTrimmed corr_rej_trimmed; corr_rej_trimmed.setOverlapRatio(rej_trimmed_overlap); corr_rej_trimmed.setInputCorrespondences(correspondences); @@ -345,17 +346,17 @@ TEST (PCL, CorrespondenceRejectorTrimmed) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, CorrespondenceRejectorVarTrimmed) { - CloudXYZConstPtr source (new CloudXYZ (cloud_source)); - CloudXYZConstPtr target (new CloudXYZ (cloud_target)); + CloudXYZConstPtr source = pcl::make_shared (cloud_source); + CloudXYZConstPtr target = pcl::make_shared (cloud_target); // re-do correspondence estimation - pcl::CorrespondencesPtr correspondences (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences = pcl::make_shared (); pcl::registration::CorrespondenceEstimation corr_est; corr_est.setInputSource (source); corr_est.setInputTarget (target); corr_est.determineCorrespondences (*correspondences); - pcl::CorrespondencesPtr correspondences_result_rej_var_trimmed_dist (new pcl::Correspondences); + pcl::CorrespondencesPtr correspondences_result_rej_var_trimmed_dist = pcl::make_shared (); pcl::registration::CorrespondenceRejectorVarTrimmed corr_rej_var_trimmed_dist; corr_rej_var_trimmed_dist.setInputSource (source); corr_rej_var_trimmed_dist.setInputTarget (target); @@ -378,8 +379,8 @@ TEST (PCL, CorrespondenceRejectorVarTrimmed) TEST (PCL, TransformationEstimationSVD) { // Ideal conditions for the estimation (no noise, exact correspondences) - CloudXYZConstPtr source (new CloudXYZ (cloud_target)); - CloudXYZPtr target (new CloudXYZ ()); + CloudXYZConstPtr source = pcl::make_shared (cloud_target); + CloudXYZPtr target = pcl::make_shared (); pcl::transformPointCloud (*source, *target, T_ref); Eigen::Matrix4f T_SVD_1; @@ -421,8 +422,8 @@ TEST (PCL, TransformationEstimationSVD) TEST (PCL, TransformationEstimationDualQuaternion) { // Ideal conditions for the estimation (no noise, exact correspondences) - CloudXYZConstPtr source (new CloudXYZ (cloud_target)); - CloudXYZPtr target (new CloudXYZ ()); + CloudXYZConstPtr source = pcl::make_shared (cloud_target); + CloudXYZPtr target = pcl::make_shared (); pcl::transformPointCloud (*source, *target, T_ref); Eigen::Matrix4f T_DQ_1; @@ -466,7 +467,7 @@ TEST (PCL, TransformationEstimationPointToPlaneLLS) pcl::registration::TransformationEstimationPointToPlaneLLS transform_estimator; // Create a test cloud - pcl::PointCloud::Ptr src (new pcl::PointCloud); + pcl::PointCloud::Ptr src = pcl::make_shared> (); src->height = 1; src->is_dense = true; for (float x = -5.0f; x <= 5.0f; x += 0.5f) @@ -499,7 +500,7 @@ TEST (PCL, TransformationEstimationPointToPlaneLLS) ground_truth_tform.row (2) << -0.0500f, -0.0200f, 0.9986f, 0.3000f; ground_truth_tform.row (3) << 0.0000f, 0.0000f, 0.0000f, 1.0000f; - pcl::PointCloud::Ptr tgt (new pcl::PointCloud); + pcl::PointCloud::Ptr tgt = pcl::make_shared> (); pcl::transformPointCloudWithNormals (*src, *tgt, ground_truth_tform); @@ -514,8 +515,8 @@ TEST (PCL, TransformationEstimationPointToPlaneLLS) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST (PCL, TransformationEstimationLM) { - CloudXYZConstPtr source (new CloudXYZ (cloud_target)); - CloudXYZPtr target (new CloudXYZ ()); + CloudXYZConstPtr source = pcl::make_shared (cloud_target); + CloudXYZPtr target = pcl::make_shared (); pcl::transformPointCloud (*source, *target, T_ref); // Test the float precision first @@ -600,7 +601,7 @@ TEST (PCL, TransformationEstimationPointToPlane) pcl::registration::TransformationEstimationPointToPlane transform_estimator_float; // Create a test cloud - pcl::PointCloud::Ptr src (new pcl::PointCloud); + pcl::PointCloud::Ptr src = pcl::make_shared> (); src->height = 1; src->is_dense = true; for (float x = -5.0f; x <= 5.0f; x += 0.5f) @@ -633,7 +634,7 @@ TEST (PCL, TransformationEstimationPointToPlane) ground_truth_tform.row (2) << -0.0500f, -0.0200f, 0.9986f, 0.3000f; ground_truth_tform.row (3) << 0.0000f, 0.0000f, 0.0000f, 1.0000f; - pcl::PointCloud::Ptr tgt (new pcl::PointCloud); + pcl::PointCloud::Ptr tgt = pcl::make_shared> (); pcl::transformPointCloudWithNormals (*src, *tgt, ground_truth_tform); diff --git a/test/search/test_search.cpp b/test/search/test_search.cpp index 8d4a0b88d21..6c66f997340 100644 --- a/test/search/test_search.cpp +++ b/test/search/test_search.cpp @@ -39,6 +39,8 @@ #include +#include + #include #include #include @@ -308,7 +310,7 @@ testKNNSearch (typename PointCloud::ConstPtr point_cloud, vector> (input_indices); #pragma omp parallel for for (int sIdx = 0; sIdx < int (search_methods.size ()); ++sIdx) @@ -378,7 +380,7 @@ testRadiusSearch (typename PointCloud::ConstPtr point_cloud, vector> (input_indices); #pragma omp parallel for for (int sIdx = 0; sIdx < int (search_methods.size ()); ++sIdx) diff --git a/test/surface/test_concave_hull.cpp b/test/surface/test_concave_hull.cpp index 2a59b0665d4..f9c7a3211d0 100644 --- a/test/surface/test_concave_hull.cpp +++ b/test/surface/test_concave_hull.cpp @@ -48,6 +48,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; @@ -289,7 +291,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -305,7 +307,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -315,7 +317,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -330,7 +332,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_convex_hull.cpp b/test/surface/test_convex_hull.cpp index 774312f1097..bf52f432b53 100644 --- a/test/surface/test_convex_hull.cpp +++ b/test/surface/test_convex_hull.cpp @@ -41,6 +41,8 @@ #include +#include + #include #include #include @@ -500,7 +502,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -516,7 +518,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -526,7 +528,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -541,7 +543,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_ear_clipping.cpp b/test/surface/test_ear_clipping.cpp index 062ea104ab1..8b1c9d8e8db 100644 --- a/test/surface/test_ear_clipping.cpp +++ b/test/surface/test_ear_clipping.cpp @@ -46,6 +46,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -195,7 +197,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -211,7 +213,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -220,7 +222,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -235,7 +237,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_gp3.cpp b/test/surface/test_gp3.cpp index f609f605b0a..6257b2ab6e1 100644 --- a/test/surface/test_gp3.cpp +++ b/test/surface/test_gp3.cpp @@ -49,6 +49,8 @@ #include #include #include + +#include using namespace pcl; using namespace pcl::io; using namespace std; @@ -255,7 +257,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -271,7 +273,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -280,7 +282,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -295,7 +297,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_grid_projection.cpp b/test/surface/test_grid_projection.cpp index 51b7aee80b0..258916a6b5c 100644 --- a/test/surface/test_grid_projection.cpp +++ b/test/surface/test_grid_projection.cpp @@ -46,6 +46,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -99,7 +101,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -115,7 +117,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -124,7 +126,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -139,7 +141,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_marching_cubes.cpp b/test/surface/test_marching_cubes.cpp index e4ca075a25e..0821801307a 100644 --- a/test/surface/test_marching_cubes.cpp +++ b/test/surface/test_marching_cubes.cpp @@ -49,6 +49,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -117,7 +119,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -133,7 +135,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -142,7 +144,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -157,7 +159,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_moving_least_squares.cpp b/test/surface/test_moving_least_squares.cpp index dc396885eb9..ae8e80ddc61 100644 --- a/test/surface/test_moving_least_squares.cpp +++ b/test/surface/test_moving_least_squares.cpp @@ -46,6 +46,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -189,7 +191,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -205,7 +207,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -214,7 +216,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -229,7 +231,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/surface/test_organized_fast_mesh.cpp b/test/surface/test_organized_fast_mesh.cpp index 621bc3286a2..879aa122125 100644 --- a/test/surface/test_organized_fast_mesh.cpp +++ b/test/surface/test_organized_fast_mesh.cpp @@ -46,6 +46,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace std; @@ -126,7 +128,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -142,7 +144,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -151,7 +153,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -166,7 +168,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/test/visualization/test_visualization.cpp b/test/visualization/test_visualization.cpp index 9f0b3ba27ca..c43ebc506a1 100644 --- a/test/visualization/test_visualization.cpp +++ b/test/visualization/test_visualization.cpp @@ -44,6 +44,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace pcl::visualization; @@ -166,7 +168,7 @@ main (int argc, char** argv) fromPCLPointCloud2 (cloud_blob, *cloud); // Create search tree - tree.reset (new search::KdTree (false)); + tree = pcl::make_shared> (false); tree->setInputCloud (cloud); // Normal estimation @@ -182,7 +184,7 @@ main (int argc, char** argv) pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // Create search tree - tree2.reset (new search::KdTree); + tree2 = pcl::make_shared> (); tree2->setInputCloud (cloud_with_normals); // Process for update cloud @@ -192,7 +194,7 @@ main (int argc, char** argv) loadPCDFile (argv[2], cloud_blob1); fromPCLPointCloud2 (cloud_blob1, *cloud1); // Create search tree - tree3.reset (new search::KdTree (false)); + tree3 = pcl::make_shared> (false); tree3->setInputCloud (cloud1); // Normal estimation @@ -207,7 +209,7 @@ main (int argc, char** argv) // Concatenate XYZ and normal information pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1); // Create search tree - tree4.reset (new search::KdTree); + tree4 = pcl::make_shared> (); tree4->setInputCloud (cloud_with_normals1); } diff --git a/tools/fpfh_estimation.cpp b/tools/fpfh_estimation.cpp index 84d945f9254..3c724c5e112 100644 --- a/tools/fpfh_estimation.cpp +++ b/tools/fpfh_estimation.cpp @@ -3,7 +3,7 @@ * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2010-2012, Willow Garage, Inc. - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include #include +#include using namespace pcl; using namespace pcl::io; @@ -103,7 +104,7 @@ compute (const pcl::PCLPointCloud2::ConstPtr &input, pcl::PCLPointCloud2 &output FPFHEstimation ne; ne.setInputCloud (xyznormals); ne.setInputNormals (xyznormals); - ne.setSearchMethod (search::KdTree::Ptr (new search::KdTree)); + ne.setSearchMethod (pcl::make_shared> ()); ne.setKSearch (k); ne.setRadiusSearch (radius); diff --git a/tools/gp3_surface.cpp b/tools/gp3_surface.cpp index 14abb22a2fe..e684fbb7fc8 100644 --- a/tools/gp3_surface.cpp +++ b/tools/gp3_surface.cpp @@ -3,7 +3,7 @@ * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2010-2011, Willow Garage, Inc. - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include #include +#include using namespace pcl; using namespace pcl::io; @@ -84,10 +85,10 @@ compute (const PointCloud::Ptr &input, pcl::PolygonMesh &output, // Estimate TicToc tt; tt.tic (); - + print_highlight (stderr, "Computing "); - PointCloud::Ptr cloud (new PointCloud ()); + PointCloud::Ptr cloud = pcl::make_shared> (); for (size_t i = 0; i < input->size (); ++i) if (std::isfinite (input->points[i].x)) cloud->push_back (input->points[i]); @@ -97,7 +98,7 @@ compute (const PointCloud::Ptr &input, pcl::PolygonMesh &output, cloud->is_dense = true; GreedyProjectionTriangulation gpt; - gpt.setSearchMethod (pcl::search::KdTree::Ptr (new pcl::search::KdTree)); + gpt.setSearchMethod (pcl::make_shared> ()); gpt.setInputCloud (cloud); gpt.setSearchRadius (radius); gpt.setMu (mu); @@ -152,8 +153,8 @@ main (int argc, char** argv) parse_argument (argc, argv, "-radius", radius); // Load the first file - PointCloud::Ptr cloud (new PointCloud); - if (!loadCloud (argv[pcd_file_indices[0]], *cloud)) + PointCloud::Ptr cloud = pcl::make_shared> (); + if (!loadCloud (argv[pcd_file_indices[0]], *cloud)) return (-1); // Perform the surface triangulation diff --git a/tools/icp.cpp b/tools/icp.cpp index 1ea71c4f55c..1f9efc62c82 100644 --- a/tools/icp.cpp +++ b/tools/icp.cpp @@ -76,12 +76,12 @@ main (int argc, char **argv) if (nonLinear) { std::cout << "Using IterativeClosestPointNonLinear" << std::endl; - icp.reset (new pcl::IterativeClosestPointNonLinear ()); + icp = pcl::make_shared> (); } else { std::cout << "Using IterativeClosestPoint" << std::endl; - icp.reset (new pcl::IterativeClosestPoint ()); + icp = pcl::make_shared> (); } icp->setMaximumIterations (iter); icp->setMaxCorrespondenceDistance (dist); diff --git a/tools/image_grabber_saver.cpp b/tools/image_grabber_saver.cpp index ec5f5309536..060639339c1 100644 --- a/tools/image_grabber_saver.cpp +++ b/tools/image_grabber_saver.cpp @@ -44,6 +44,8 @@ #include #include +#include + using pcl::console::print_error; using pcl::console::print_info; using pcl::console::print_value; @@ -121,7 +123,7 @@ main (int argc, char** argv) if (!rgb_path.empty() && !depth_path.empty() && boost::filesystem::exists (rgb_path) && boost::filesystem::exists (depth_path)) { - grabber.reset (new pcl::ImageGrabber (depth_path, rgb_path, frames_per_second, false)); + grabber = pcl::make_shared> (depth_path, rgb_path, frames_per_second, false); } else { diff --git a/tools/image_grabber_viewer.cpp b/tools/image_grabber_viewer.cpp index 63cec4a7522..89adcbf2f5d 100644 --- a/tools/image_grabber_viewer.cpp +++ b/tools/image_grabber_viewer.cpp @@ -48,6 +48,8 @@ #include #include +#include + using namespace std::chrono_literals; using pcl::console::print_error; using pcl::console::print_info; @@ -156,7 +158,7 @@ main (int argc, char** argv) double opaque; pcl::console::parse_argument (argc, argv, "-opaque", opaque); - cloud_viewer.reset (new pcl::visualization::PCLVisualizer (argc, argv, "PCD viewer")); + cloud_viewer = pcl::make_shared (argc, argv, "PCD viewer"); #ifdef DISPLAY_IMAGE img_viewer.reset (new pcl::visualization::ImageViewer ("OpenNI Viewer")); @@ -200,7 +202,7 @@ main (int argc, char** argv) std::cout << "path: " << path << std::endl; if (!path.empty() && boost::filesystem::exists (path)) { - grabber.reset (new pcl::ImageGrabber (path, frames_per_second, repeat, use_pclzf)); + grabber = pcl::make_shared> (path, frames_per_second, repeat, use_pclzf); } else { diff --git a/tools/normal_estimation.cpp b/tools/normal_estimation.cpp index e48e5251d54..ea96ecd197f 100644 --- a/tools/normal_estimation.cpp +++ b/tools/normal_estimation.cpp @@ -4,7 +4,7 @@ * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2010-2011, Willow Garage, Inc. * Copyright (c) 2012-, Open Perception, Inc. - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,8 @@ #include #include +#include + using namespace std; using namespace pcl; using namespace pcl::io; @@ -84,12 +86,12 @@ compute (const pcl::PCLPointCloud2::ConstPtr &input, pcl::PCLPointCloud2 &output int k, double radius) { // Convert data to PointCloud - PointCloud::Ptr xyz (new PointCloud); + PointCloud::Ptr xyz = pcl::make_shared> (); fromPCLPointCloud2 (*input, *xyz); TicToc tt; tt.tic (); - + PointCloud normals; // Try our luck with organized integral image based normal estimation @@ -106,7 +108,7 @@ compute (const pcl::PCLPointCloud2::ConstPtr &input, pcl::PCLPointCloud2 &output { NormalEstimation ne; ne.setInputCloud (xyz); - ne.setSearchMethod (search::KdTree::Ptr (new search::KdTree)); + ne.setSearchMethod (pcl::make_shared> ()); ne.setKSearch (k); ne.setRadiusSearch (radius); ne.compute (normals); @@ -139,8 +141,8 @@ batchProcess (const vector &pcd_files, string &output_dir, int k, double // Load the first file Eigen::Vector4f translation; Eigen::Quaternionf rotation; - pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2); - if (!loadCloud (pcd_files[i], *cloud, translation, rotation)) + pcl::PCLPointCloud2::Ptr cloud = pcl::make_shared (); + if (!loadCloud (pcd_files[i], *cloud, translation, rotation)) continue; // Perform the feature estimation @@ -152,7 +154,7 @@ batchProcess (const vector &pcd_files, string &output_dir, int k, double boost::trim (filename); vector st; boost::split (st, filename, boost::is_any_of ("/\\"), boost::token_compress_on); - + // Save into the second file stringstream ss; ss << output_dir << "/" << st.at (st.size () - 1); @@ -205,14 +207,14 @@ main (int argc, char** argv) return (-1); } - print_info ("Estimating normals with a k/radius/smoothing size of: "); - print_value ("%d / %f / %f\n", k, radius, radius); + print_info ("Estimating normals with a k/radius/smoothing size of: "); + print_value ("%d / %f / %f\n", k, radius, radius); // Load the first file Eigen::Vector4f translation; Eigen::Quaternionf rotation; - pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2); - if (!loadCloud (argv[p_file_indices[0]], *cloud, translation, rotation)) + pcl::PCLPointCloud2::Ptr cloud = pcl::make_shared (); + if (!loadCloud (argv[p_file_indices[0]], *cloud, translation, rotation)) return (-1); // Perform the feature estimation diff --git a/tools/openni_image.cpp b/tools/openni_image.cpp index 00c0b903036..8dba0c3d1ca 100644 --- a/tools/openni_image.cpp +++ b/tools/openni_image.cpp @@ -54,6 +54,8 @@ #include #include +#include + using namespace std; using namespace std::chrono_literals; using namespace pcl; @@ -347,7 +349,7 @@ class Writer Writer (Buffer &buf) : buf_ (buf) { - thread_.reset (new std::thread (&Writer::receiveAndProcess, this)); + thread_ = pcl::make_shared (&Writer::receiveAndProcess, this); } /////////////////////////////////////////////////////////////////////////////////////// @@ -435,7 +437,7 @@ class Driver , buf_write_ (buf_write) , buf_vis_ (buf_vis) { - thread_.reset (new std::thread (&Driver::grabAndSend, this)); + thread_ = pcl::make_shared (&Driver::grabAndSend, this); } /////////////////////////////////////////////////////////////////////////////////////// @@ -551,8 +553,8 @@ class Viewer : buf_ (buf) , image_cld_init_ (false), depth_image_cld_init_ (false) { - image_viewer_.reset (new visualization::ImageViewer ("PCL/OpenNI RGB image viewer")); - depth_image_viewer_.reset (new visualization::ImageViewer ("PCL/OpenNI depth image viewer")); + image_viewer_ = pcl::make_shared ("PCL/OpenNI RGB image viewer"); + depth_image_viewer_ = pcl::make_shared ("PCL/OpenNI depth image viewer"); receiveAndView (); } @@ -773,7 +775,7 @@ main (int argc, char ** argv) Writer writer (buf_write); boost::shared_ptr viewer; if (global_visualize) - viewer.reset (new Viewer (buf_vis)); + viewer = pcl::make_shared (buf_vis); else save_data = true; diff --git a/tools/pcd_grabber_viewer.cpp b/tools/pcd_grabber_viewer.cpp index ed3a64b6c55..92c489d9fd8 100644 --- a/tools/pcd_grabber_viewer.cpp +++ b/tools/pcd_grabber_viewer.cpp @@ -46,6 +46,8 @@ #include #include +#include + using namespace std::chrono_literals; using pcl::console::print_error; using pcl::console::print_info; @@ -140,7 +142,7 @@ main (int argc, char** argv) double opaque; pcl::console::parse_argument (argc, argv, "-opaque", opaque); - cloud_viewer.reset (new pcl::visualization::PCLVisualizer (argc, argv, "PCD viewer")); + cloud_viewer = pcl::make_shared (argc, argv, "PCD viewer"); #ifdef DISPLAY_IMAGE img_viewer.reset (new pcl::visualization::ImageViewer ("OpenNI Viewer")); @@ -181,7 +183,7 @@ main (int argc, char** argv) std::cout << "path: " << path << std::endl; if (!path.empty() && boost::filesystem::exists (path)) { - grabber.reset (new pcl::PCDGrabber (path, frames_per_second, repeat)); + grabber = pcl::make_shared> (path, frames_per_second, repeat); } else { @@ -207,7 +209,7 @@ main (int argc, char** argv) // Sort the read files by name sort (pcd_files.begin (), pcd_files.end ()); - grabber.reset (new pcl::PCDGrabber (pcd_files, frames_per_second, repeat)); + grabber = pcl::make_shared> (pcd_files, frames_per_second, repeat); } EventHelper h; diff --git a/tools/pcd_viewer.cpp b/tools/pcd_viewer.cpp index fbca56df1c8..7ceb2980aa7 100644 --- a/tools/pcd_viewer.cpp +++ b/tools/pcd_viewer.cpp @@ -44,6 +44,8 @@ #include #include #include + +#include #include //#include #include @@ -165,7 +167,7 @@ pp_callback (const pcl::visualization::PointPickingEvent& event, void* cookie) if (!cloud) { cloud = *reinterpret_cast (cookie); - xyzcloud.reset (new pcl::PointCloud); + xyzcloud = pcl::make_shared> (); pcl::fromPCLPointCloud2 (*cloud, *xyzcloud); search.setInputCloud (xyzcloud); } @@ -363,7 +365,7 @@ main (int argc, char** argv) // Create the PCLVisualizer object here on the first encountered XYZ file if (!p) - p.reset (new pcl::visualization::PCLVisualizer (argc, argv, "PCD viewer")); + p = pcl::make_shared (argc, argv, "PCD viewer"); // Multiview enabled? if (mview) @@ -420,7 +422,7 @@ main (int argc, char** argv) for (size_t i = 0; i < p_file_indices.size (); ++i) { tt.tic (); - cloud.reset (new pcl::PCLPointCloud2); + cloud = pcl::make_shared (); Eigen::Vector4f origin; Eigen::Quaternionf orientation; int version; @@ -451,7 +453,7 @@ main (int argc, char** argv) cloud_name << argv[p_file_indices.at (i)]; if (!ph) - ph.reset (new pcl::visualization::PCLPlotter); + ph = pcl::make_shared (); pcl::getMinMax (*cloud, 0, cloud->fields[0].name, min_p, max_p); ph->addFeatureHistogram (*cloud, cloud->fields[0].name, cloud_name.str ()); @@ -482,7 +484,7 @@ main (int argc, char** argv) // Create the PCLVisualizer object here on the first encountered XYZ file if (!p) { - p.reset (new pcl::visualization::PCLVisualizer (argc, argv, "PCD viewer")); + p = pcl::make_shared (argc, argv, "PCD viewer"); if (use_pp) // Only enable the point picking callback if the command line parameter is enabled p->registerPointPickingCallback (&pp_callback, static_cast (&cloud)); @@ -521,15 +523,15 @@ main (int argc, char** argv) if (fcolorparam) { if (fcolor_r.size () > i && fcolor_g.size () > i && fcolor_b.size () > i) - color_handler.reset (new pcl::visualization::PointCloudColorHandlerCustom (cloud, fcolor_r[i], fcolor_g[i], fcolor_b[i])); + color_handler = pcl::make_shared> (cloud, fcolor_r[i], fcolor_g[i], fcolor_b[i]); else - color_handler.reset (new pcl::visualization::PointCloudColorHandlerRandom (cloud)); + color_handler = pcl::make_shared> (cloud); } else - color_handler.reset (new pcl::visualization::PointCloudColorHandlerRandom (cloud)); + color_handler = pcl::make_shared> (cloud); // Add the dataset with a XYZ and a random handler - geometry_handler.reset (new pcl::visualization::PointCloudGeometryHandlerXYZ (cloud)); + geometry_handler = pcl::make_shared> (cloud); // Add the cloud to the renderer //p->addPointCloud (cloud_xyz, geometry_handler, color_handler, cloud_name.str (), viewport); p->addPointCloud (cloud, geometry_handler, color_handler, origin, orientation, cloud_name.str (), viewport); @@ -620,16 +622,16 @@ main (int argc, char** argv) if (cloud->fields[f].name == "rgb" || cloud->fields[f].name == "rgba") { rgb_idx = f - invalid_fields_count + 1 /* first is ColorHandlerRandom */; - color_handler.reset (new pcl::visualization::PointCloudColorHandlerRGBField (cloud)); + color_handler = pcl::make_shared> (cloud); } else if (cloud->fields[f].name == "label") { label_idx = f - invalid_fields_count + 1; - color_handler.reset (new pcl::visualization::PointCloudColorHandlerLabelField (cloud, !use_optimal_l_colors)); + color_handler = pcl::make_shared> (cloud, !use_optimal_l_colors); } else { - color_handler.reset (new pcl::visualization::PointCloudColorHandlerGenericField (cloud, cloud->fields[f].name)); + color_handler = pcl::make_shared> (cloud, cloud->fields[f].name); } // Add the cloud to the renderer //p->addPointCloud (cloud_xyz, color_handler, cloud_name.str (), viewport); @@ -640,7 +642,7 @@ main (int argc, char** argv) } // Additionally, add normals as a handler - geometry_handler.reset (new pcl::visualization::PointCloudGeometryHandlerSurfaceNormal (cloud)); + geometry_handler = pcl::make_shared> (cloud); if (geometry_handler->isCapable ()) //p->addPointCloud (cloud_xyz, geometry_handler, cloud_name.str (), viewport); p->addPointCloud (cloud, geometry_handler, origin, orientation, cloud_name.str (), viewport); diff --git a/tools/spin_estimation.cpp b/tools/spin_estimation.cpp index b5444691b2e..50b63fe8379 100644 --- a/tools/spin_estimation.cpp +++ b/tools/spin_estimation.cpp @@ -3,7 +3,7 @@ * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2010-2011, Willow Garage, Inc. - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include #include #include +#include using namespace pcl; using namespace pcl::io; @@ -106,9 +107,9 @@ saveCloud (const std::string &filename, const pcl::PCLPointCloud2 &output) tt.tic (); print_highlight ("Saving "); print_value ("%s ", filename.c_str ()); - + io::savePCDFile (filename, output, translation, orientation, false); - + print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n"); } @@ -145,15 +146,15 @@ main (int argc, char** argv) parse_argument (argc, argv, "-neigh", min_neigh); // Load the first file - pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2); - if (!loadCloud (argv[p_file_indices[0]], *cloud)) + pcl::PCLPointCloud2::Ptr cloud = pcl::make_shared (); + if (!loadCloud (argv[p_file_indices[0]], *cloud)) return (-1); // Perform the feature estimation pcl::PCLPointCloud2 output; - + // Convert data to PointCloud - PointCloud::Ptr xyznormals (new PointCloud); + PointCloud::Ptr xyznormals = pcl::make_shared> (); fromPCLPointCloud2 (*cloud, *xyznormals); // Estimate @@ -163,11 +164,11 @@ main (int argc, char** argv) print_highlight (stderr, "Computing "); using SpinImage = Histogram<153>; - SpinImageEstimation spin_est (image_width, support_angle, min_neigh); + SpinImageEstimation spin_est (image_width, support_angle, min_neigh); //spin_est.setInputWithNormals (xyznormals, xyznormals); spin_est.setInputCloud (xyznormals); spin_est.setInputNormals (xyznormals); - spin_est.setSearchMethod (search::KdTree::Ptr (new search::KdTree)); + spin_est.setSearchMethod (pcl::make_shared> ()); spin_est.setRadiusSearch (radius); if (find_argument(argc, argv, "-radial") > 0) diff --git a/tools/vfh_estimation.cpp b/tools/vfh_estimation.cpp index 374a0cc900c..e78224aa56d 100644 --- a/tools/vfh_estimation.cpp +++ b/tools/vfh_estimation.cpp @@ -3,7 +3,7 @@ * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2010-2011, Willow Garage, Inc. - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,8 @@ #include #include +#include + using namespace pcl; using namespace pcl::io; using namespace pcl::console; @@ -82,14 +84,14 @@ compute (const PointCloud::Ptr &input, PointCloud // Estimate TicToc tt; tt.tic (); - + print_highlight (stderr, "Computing "); VFHEstimation ne; - ne.setSearchMethod (search::KdTree::Ptr (new search::KdTree)); + ne.setSearchMethod (pcl::make_shared> ()); ne.setInputCloud (input); ne.setInputNormals (input); - + ne.compute (output); print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n"); @@ -102,9 +104,9 @@ saveCloud (const std::string &filename, const PointCloud &outpu tt.tic (); print_highlight ("Saving "); print_value ("%s ", filename.c_str ()); - + io::savePCDFile (filename, output, false); - + print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n"); } @@ -131,8 +133,8 @@ main (int argc, char** argv) } // Load the first file - PointCloud::Ptr cloud (new PointCloud); - if (!loadCloud (argv[p_file_indices[0]], *cloud)) + PointCloud::Ptr cloud = pcl::make_shared> (); + if (!loadCloud (argv[p_file_indices[0]], *cloud)) return (-1); // Perform the feature estimation diff --git a/tracking/include/pcl/tracking/impl/kld_adaptive_particle_filter_omp.hpp b/tracking/include/pcl/tracking/impl/kld_adaptive_particle_filter_omp.hpp index e1fe8630f63..035ef04d0f3 100644 --- a/tracking/include/pcl/tracking/impl/kld_adaptive_particle_filter_omp.hpp +++ b/tracking/include/pcl/tracking/impl/kld_adaptive_particle_filter_omp.hpp @@ -3,6 +3,8 @@ #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// template void pcl::tracking::KLDAdaptiveParticleFilterOMPTracker::setNumberOfThreads (unsigned int nr_threads) @@ -72,7 +74,7 @@ pcl::tracking::KLDAdaptiveParticleFilterOMPTracker::weight () std::vector indices_list (particle_num_); for (int i = 0; i < particle_num_; i++) { - indices_list[i] = IndicesPtr (new std::vector); + indices_list[i] = pcl::make_shared>(); } #ifdef _OPENMP #pragma omp parallel for num_threads(threads_) diff --git a/tracking/include/pcl/tracking/impl/particle_filter_omp.hpp b/tracking/include/pcl/tracking/impl/particle_filter_omp.hpp index bfc100bc462..689e4395d80 100644 --- a/tracking/include/pcl/tracking/impl/particle_filter_omp.hpp +++ b/tracking/include/pcl/tracking/impl/particle_filter_omp.hpp @@ -3,6 +3,8 @@ #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// template void pcl::tracking::ParticleFilterOMPTracker::setNumberOfThreads (unsigned int nr_threads) @@ -72,7 +74,7 @@ pcl::tracking::ParticleFilterOMPTracker::weight () std::vector indices_list (particle_num_); for (int i = 0; i < particle_num_; i++) { - indices_list[i] = IndicesPtr (new std::vector); + indices_list[i] = pcl::make_shared>(); } #ifdef _OPENMP #pragma omp parallel for num_threads(threads_) diff --git a/visualization/include/pcl/visualization/impl/registration_visualizer.hpp b/visualization/include/pcl/visualization/impl/registration_visualizer.hpp index 9ed5b62da9a..4a10e1d0f7d 100644 --- a/visualization/include/pcl/visualization/impl/registration_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/registration_visualizer.hpp @@ -38,6 +38,8 @@ #include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// template void pcl::RegistrationVisualizer::startDisplay () @@ -60,7 +62,7 @@ pcl::RegistrationVisualizer::runDisplay () { // Open 3D viewer viewer_ - = pcl::visualization::PCLVisualizer::Ptr (new pcl::visualization::PCLVisualizer ("3D Viewer")); + = pcl::make_shared("3D Viewer"); viewer_->initCameraParameters (); // Create the handlers for the three point clouds buffers: cloud_source_, cloud_target_ and cloud_intermediate_ diff --git a/visualization/src/cloud_viewer.cpp b/visualization/src/cloud_viewer.cpp index 72d590a4a5a..6417d7a643f 100644 --- a/visualization/src/cloud_viewer.cpp +++ b/visualization/src/cloud_viewer.cpp @@ -42,6 +42,8 @@ #include #include +#include + namespace pcl { struct cloud_show_base @@ -178,7 +180,7 @@ struct pcl::visualization::CloudViewer::CloudViewer_impl { using namespace pcl::visualization; - viewer_ = boost::shared_ptr(new PCLVisualizer (window_name_, true)); + viewer_ = pcl::make_shared(window_name_, true); viewer_->setBackgroundColor (0.1, 0.1, 0.1); viewer_->addCoordinateSystem (0.1, "global");