-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathKinect2Grabber.cpp
More file actions
64 lines (62 loc) · 1.87 KB
/
Kinect2Grabber.cpp
File metadata and controls
64 lines (62 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Disable Error C4996 that occur when using Boost.Signals2.
#ifdef _DEBUG
#define _SCL_SECURE_NO_WARNINGS
#endif
#include "kinect2Grabber.h"
#include <pcl/visualization/pcl_visualizer.h>
#include"boost/thread/thread.hpp"
//typedef pcl::PointXYZRGBA PointType;
//
//int main(int argc, char* argv[])
//{
// // PCL Visualizer
// boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(
// new pcl::visualization::PCLVisualizer("Point Cloud Viewer"));
// viewer->setCameraPosition(0.0, 0.0, -2.5, 0.0, 0.0, 0.0);
//
// // Point Cloud
// pcl::PointCloud<PointType>::ConstPtr cloud;
//
// // Retrieved Point Cloud Callback Function
// boost::mutex mutex;
// boost::function<void(const pcl::PointCloud<PointType>::ConstPtr&)> function =
// [&cloud, &mutex](const pcl::PointCloud<PointType>::ConstPtr& ptr) {
// boost::mutex::scoped_lock lock(mutex);
//
// /* Point Cloud Processing */
//
// cloud = ptr->makeShared();
// };
//
// // Kinect2Grabber
// boost::shared_ptr<pcl::Grabber> grabber = boost::make_shared<pcl::Kinect2Grabber>();
//
// // Register Callback Function
// boost::signals2::connection connection = grabber->registerCallback(function);
//
// // Start Grabber
// grabber->start();
//
// while (!viewer->wasStopped()) {
// // Update Viewer
// viewer->spinOnce();
//
// boost::mutex::scoped_try_lock lock(mutex);
// if (lock.owns_lock() && cloud) {
// // Update Point Cloud
// if (!viewer->updatePointCloud(cloud, "cloud")) {
// viewer->addPointCloud(cloud, "cloud");
// }
// }
// }
//
// // Stop Grabber
// grabber->stop();
//
// // Disconnect Callback Function
// if (connection.connected()) {
// connection.disconnect();
// }
//
// return 0;
//}