-
Notifications
You must be signed in to change notification settings - Fork 2
/
pcl_reader_freenect.cpp
46 lines (26 loc) · 1.17 KB
/
pcl_reader_freenect.cpp
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
#include "freenect_grabber.hpp"
const int distance = 7000;
int main( int argc, char** argv )
{
boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGB>> cloud;
freenectGrabber<pcl::PointXYZRGB> c;
cloud = c.get_point_cloud(distance, true);
cloud->sensor_orientation_.w () = 0.0;
cloud->sensor_orientation_.x () = 1.0;
cloud->sensor_orientation_.y () = 0.0;
cloud->sensor_orientation_.z () = 0.0;
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
viewer->setBackgroundColor (255, 255, 255);
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
viewer->addPointCloud<pcl::PointXYZRGB> (cloud, rgb, "sample cloud");
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
while (!viewer->wasStopped ()) {
viewer->spinOnce ();
cloud = c.get_point_cloud(distance, true);
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
viewer->updatePointCloud<pcl::PointXYZRGB> (cloud, rgb, "sample cloud");
}
cloud->height = 1;
cloud->width = cloud->points.size();
return 0;
}