c++ - How can I make a point cloud shared? -


i'm working on kinect v2 , grabber run it. encountered problems wanting write cloud information on pcd. @ code:

int main(int argc, char* argv[])  {      boost::shared_ptr<pcl::visualization::pclvisualizer> viewer(new pcl::visualization::pclvisualizer("point cloud viewer"));      viewer->registerkeyboardcallback(&keyboard_callback, "keyboard");      viewer->registermousecallback(&mouse_callback, "mouse");       pcl::pointcloud<pcl::pointxyzrgb>::constptr cloud;      boost::function<void(const pcl::pointcloud<pcl::pointxyzrgb>::constptr&)> function =              [&cloud](const pcl::pointcloud<pcl::pointxyzrgb>::constptr &ptr){              boost::mutex::scoped_lock lock(mutex);              cloud = ptr;      };       pcl::grabber* grabber = new pcl::kinect2grabber();       boost::signals2::connection connection = grabber->registercallback(function);       grabber->start();       while (!viewer->wasstopped()){              viewer->spinonce();               if (cloud){                      if (!viewer->updatepointcloud(cloud, "cloud")){                              viewer->addpointcloud(cloud, "cloud");                              viewer->resetcameraviewpoint("cloud");                      }              }               if (getkeystate(vk_escape) < 0){                      break;              }      }       grabber->stop();       return 0;  }  

the cloud pointer boost function must const (i don't know sure). hence can't share cloud.makeshared() function , cloud->makeshared() aborted throwing exceptions. tried copy regular cloud did not work. can me how can write cloud on pcd file?


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -