99bc500dbe116dc30cd53eed43809b7c4d20d7b1
[pcl.git] /
1 #include <pcl/visualization/cloud_viewer.h>
2 #include <iostream>
3 #include <pcl/io/io.h>
4 #include <pcl/io/pcd_io.h>
5 #include <pcl/features/integral_image_normal.h>
6     
7 int 
8 main ()
9 {
10     // load point cloud
11     pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
12     pcl::io::loadPCDFile ("table_scene_mug_stereo_textured.pcd", *cloud);
13     
14     // estimate normals
15     pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);
16
17     pcl::IntegralImageNormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
18     ne.setNormalEstimationMethod (ne.AVERAGE_3D_GRADIENT);
19     ne.setMaxDepthChangeFactor(0.02f);
20     ne.setNormalSmoothingSize(10.0f);
21     ne.setInputCloud(cloud);
22     ne.compute(*normals);
23
24     // visualize normals
25     pcl::visualization::PCLVisualizer viewer("PCL Viewer");
26     viewer.setBackgroundColor (0.0, 0.0, 0.5);
27     viewer.addPointCloudNormals<pcl::PointXYZ,pcl::Normal>(cloud, normals);
28     
29     while (!viewer.wasStopped ())
30     {
31       viewer.spinOnce ();
32     }
33     return 0;
34 }