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 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;
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.
pcl::PointCloud< pcl::PointXYZRGB >::Ptr createXYZRGBCloud(const ImageSet &imageSet, const char *frameId, unsigned short minDisparity=0)
Projects the given disparity map to a PCL point cloud, including pixel RGB data.
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.