16 #include <pcl/pcl_base.h>
17 #include <pcl/point_types.h>
18 #include <pcl/io/pcd_io.h>
19 #include <pcl/filters/extract_indices.h>
21 #include <visiontransfer/deviceenumeration.h>
22 #include <visiontransfer/imagetransfer.h>
23 #include <visiontransfer/imageset.h>
24 #include <visiontransfer/reconstruct3d.h>
29 using namespace visiontransfer;
31 #define RGB_CLOUD // Undefine for monochrome cameras
34 typedef pcl::PointXYZRGB PclPointType;
36 typedef pcl::PointXYZI PclCloudType;
44 if(devices.size() == 0) {
45 std::cout <<
"No devices discovered!" << std::endl;
54 std::cout <<
"Receiving image set ..." << std::endl;
56 while(!imageTransfer.receiveImageSet(imageSet)) {
61 pcl::PointCloud<PclPointType>::Ptr cloud;
69 pcl::PointIndices::Ptr inliers(
new pcl::PointIndices());
70 for (
unsigned int i = 0; i < cloud->size(); i++) {
71 if(cloud->points[i].z < 5) {
72 inliers->indices.push_back(i);
75 pcl::ExtractIndices<PclPointType> extract;
76 extract.setInputCloud(cloud);
77 extract.setIndices(inliers);
78 extract.filterDirectly(cloud);
81 pcl::io::savePCDFile(
"cloud.pcd", *cloud,
false);
82 std::cout <<
"Written point cloud to cloud.pcd" << std::endl;
84 }
catch(
const std::exception& ex) {
85 std::cerr <<
"Exception occurred: " << ex.what() << std::endl;