int main (void) { ensenso_grabber.reset (new pcl::EnsensoGrabber ()); if (ensenso_grabber == 0) return (-1); ensenso_grabber->enumDevices (); ensenso_grabber->openTcpPort (); // default port = 24000 ensenso_grabber->openDevice (); ensenso_grabber->configureCapture (); ensenso_grabber->setExtrinsicCalibration (); // Temporary reset calibration if it has be written in EEPROM boost::function<void (const PointCloudT::ConstPtr&)> f = boost::bind (&grabberCallback, _1); ensenso_grabber->registerCallback (f); viewer.reset (new CloudViewer ("3D Viewer")); ensenso_grabber->start (); std::cout << std::endl; while (!viewer->wasStopped ()) { boost::this_thread::sleep (boost::posix_time::milliseconds (1000)); std::cout << "FPS: " << ensenso_grabber->getFramesPerSecond () << std::endl; } ensenso_grabber->stop (); ensenso_grabber->closeDevice (); return (0); }
/** @brief Main function * @return Exit status */ int main (void) { viewer_ptr.reset (new pcl::visualization::CloudViewer ("3D Viewer")); ensenso_ptr.reset (new pcl::EnsensoGrabber); ensenso_ptr->openDevice (0); ensenso_ptr->openTcpPort (); //ensenso_ptr->initExtrinsicCalibration (5); // Disable projector if you want good looking images. // You won't be able to detect a calibration pattern with the projector enabled! boost::function<void (const boost::shared_ptr<PointCloudT>&, const boost::shared_ptr<PairOfImages>&)> f = boost::bind (&grabberCallback, _1, _2); ensenso_ptr->registerCallback (f); cv::namedWindow ("Ensenso images", cv::WINDOW_AUTOSIZE); ensenso_ptr->start (); while (!viewer_ptr->wasStopped ()) { PCL_INFO("FPS: %f\n", ensenso_ptr->getFramesPerSecond ()); boost::this_thread::sleep (boost::posix_time::milliseconds (500)); } ensenso_ptr->stop (); //cv::destroyAllWindows (); // Doesn't work ensenso_ptr->closeDevice (); ensenso_ptr->closeTcpPort (); return 0; }