From bc996a7df45ebb6125bf6946b1d1a14a460e8831 Mon Sep 17 00:00:00 2001 From: Andrea Ponza Date: Tue, 28 May 2019 12:12:04 +0200 Subject: [PATCH] change new to boost::make_shared --- apps/src/organized_segmentation_demo.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/src/organized_segmentation_demo.cpp b/apps/src/organized_segmentation_demo.cpp index 4920db4690f..8263ceef6b3 100644 --- a/apps/src/organized_segmentation_demo.cpp +++ b/apps/src/organized_segmentation_demo.cpp @@ -20,7 +20,7 @@ displayPlanarRegions (std::vector, Eigen::aligned_allo unsigned char grn [6] = { 0, 255, 0, 255, 0, 255}; unsigned char blu [6] = { 0, 0, 255, 0, 255, 255}; - pcl::PointCloud::Ptr contour (new pcl::PointCloud); + pcl::PointCloud::Ptr contour = boost::make_shared > (); for (size_t i = 0; i < regions.size (); i++) { @@ -54,7 +54,7 @@ displayEuclideanClusters (const pcl::PointCloud::CloudVectorType &cluste for (size_t i = 0; i < clusters.size (); i++) { sprintf (name, "cluster_%d" , int (i)); - pcl::PointCloud::ConstPtr cluster_cloud (new pcl::PointCloud (clusters[i])); + pcl::PointCloud::ConstPtr cluster_cloud = boost::make_shared > (clusters[i]); pcl::visualization::PointCloudColorHandlerCustom color0(cluster_cloud,red[i%6],grn[i%6],blu[i%6]); if (!viewer->updatePointCloud (cluster_cloud,color0,name)) viewer->addPointCloud (cluster_cloud,color0,name); @@ -205,7 +205,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_ = boost::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,11 +250,11 @@ OrganizedSegmentationDemo::OrganizedSegmentationDemo (pcl::Grabber& grabber) : g ne.setMaxDepthChangeFactor (0.02f); 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 ()); - euclidean_cluster_comparator_ = pcl::EuclideanClusterComparator::Ptr (new pcl::EuclideanClusterComparator ()); + plane_comparator_ = boost::make_shared > (); + euclidean_comparator_ = boost::make_shared > (); + rgb_comparator_ = boost::make_shared > (); + edge_aware_comparator_ = boost::make_shared > (); + euclidean_cluster_comparator_ = boost::make_shared > (); // Set up Organized Multi Plane Segmentation mps.setMinInliers (10000); @@ -275,7 +275,7 @@ OrganizedSegmentationDemo::cloud_cb (const CloudConstPtr& cloud) FPS_CALC ("computation"); // Estimate Normals - pcl::PointCloud::Ptr normal_cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr normal_cloud = boost::make_shared > (); ne.setInputCloud (cloud); ne.compute (*normal_cloud); float* distance_map = ne.getDistanceMap (); @@ -288,7 +288,7 @@ OrganizedSegmentationDemo::cloud_cb (const CloudConstPtr& cloud) std::vector, Eigen::aligned_allocator > > regions; std::vector model_coefficients; std::vector inlier_indices; - pcl::PointCloud::Ptr labels (new pcl::PointCloud); + pcl::PointCloud::Ptr labels = boost::make_shared > (); std::vector label_indices; std::vector boundary_indices; mps.setInputNormals (normal_cloud); @@ -309,7 +309,7 @@ OrganizedSegmentationDemo::cloud_cb (const CloudConstPtr& cloud) if (use_clustering_ && !regions.empty ()) { - pcl::EuclideanClusterComparator::ExcludeLabelSetPtr plane_labels (new pcl::EuclideanClusterComparator::ExcludeLabelSet); + pcl::EuclideanClusterComparator::ExcludeLabelSetPtr plane_labels = boost::make_shared::ExcludeLabelSet> (); for (size_t i = 0; i < label_indices.size (); ++i) if (label_indices[i].indices.size () > 10000) plane_labels->insert (i);