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> 31 #define snprintf _snprintf_s 41 if(devices.size() == 0) {
42 std::cout <<
"No devices discovered!" << std::endl;
51 std::cout <<
"Receiving image set ..." << std::endl;
53 while(!imageTransfer.receiveImageSet(imageSet)) {
58 pcl::PointCloud<pcl::PointXYZI>::Ptr cloud = recon3d.
createXYZICloud(imageSet,
"world");
61 pcl::PointIndices::Ptr inliers(
new pcl::PointIndices());
62 for (
unsigned int i = 0; i < cloud->size(); i++) {
63 if(cloud->points[i].z < 5) {
64 inliers->indices.push_back(i);
67 pcl::ExtractIndices<pcl::PointXYZI> extract;
68 extract.setInputCloud(cloud);
69 extract.setIndices(inliers);
70 extract.filterDirectly(cloud);
73 pcl::io::savePCDFile(
"cloud.pcd", *cloud,
false);
74 std::cout <<
"Written point cloud to cloud.pcd" << std::endl;
76 }
catch(
const std::exception& ex) {
77 std::cerr <<
"Exception occurred: " << ex.what() << std::endl;
Transforms a disparity map into a set of 3D points.
DeviceList discoverDevices()
Discovers new devices and returns the list of all devices that have been found.
Class for synchronous transfer of image sets.
A set of one to three images, but usually two (the left camera image and the disparity map)...
Allows for the discovery of devices in the network.
pcl::PointCloud< pcl::PointXYZI >::Ptr createXYZICloud(const ImageSet &imageSet, const char *frameId, unsigned short minDisparity=0)
Projects the given disparity map to a PCL point cloud, including pixel intensities.