Skip to content

Commit

Permalink
Do not use smart pointers in openni_fast_mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
taketwo committed May 5, 2019
1 parent 15a0f9d commit 2d63b73
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions apps/src/openni_fast_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,13 @@ class OpenNIFastMesh
ofm.setInputCloud (cloud);

// Store the results in a temporary object
boost::shared_ptr<std::vector<pcl::Vertices> > temp_verts (new std::vector<pcl::Vertices>);
ofm.reconstruct (*temp_verts);
std::vector<pcl::Vertices> temp_verts;
ofm.reconstruct (temp_verts);

// Lock and copy
{
boost::mutex::scoped_lock lock (mtx_);
//boost::unique_lock<boost::shared_mutex> lock (mtx_);

// if (!vertices_)
// vertices_.reset (new std::vector<pcl::Vertices>);
//vertices_.reset (new std::vector<pcl::Vertices> (*temp_verts));
vertices_= temp_verts;
vertices_ = std::move (temp_verts);
cloud_ = cloud;//reset (new Cloud (*cloud));
}
}
Expand All @@ -118,7 +113,7 @@ class OpenNIFastMesh
interface->start ();

CloudConstPtr temp_cloud;
boost::shared_ptr<std::vector<pcl::Vertices> > temp_verts;
std::vector<pcl::Vertices> temp_verts;

while (!view->wasStopped ())
{
Expand All @@ -129,12 +124,12 @@ class OpenNIFastMesh
}

temp_cloud = cloud_;
temp_verts = vertices_;
temp_verts = std::move (vertices_);
mtx_.unlock ();

if (!view->updatePolygonMesh<PointType> (temp_cloud, *temp_verts, "surface"))
if (!view->updatePolygonMesh<PointType> (temp_cloud, temp_verts, "surface"))
{
view->addPolygonMesh<PointType> (temp_cloud, *temp_verts, "surface");
view->addPolygonMesh<PointType> (temp_cloud, temp_verts, "surface");
view->resetCameraViewpoint ("surface");
}

Expand All @@ -150,7 +145,7 @@ class OpenNIFastMesh
boost::mutex mtx_;
// Data
CloudConstPtr cloud_;
boost::shared_ptr<std::vector<pcl::Vertices> > vertices_;
std::vector<pcl::Vertices> vertices_;
pcl::PolygonMesh::Ptr mesh_;

pcl::visualization::PCLVisualizer::Ptr view;
Expand Down

0 comments on commit 2d63b73

Please sign in to comment.