[ Writing PCD data ] [ Using PCL in your own project ]
[ . or : or -> ]
This is what the flow seems like:
C++ file -> setting up CMakeLists.txt for generating a makefile -> running make to get an executable -> execute!
Here’s the code copy pasted from the linked tutorial:
#include <pcl/io/pcd_io.h> // i/o
#include <pcl/point_types.h> // pointT structs</code>
// struct PointXYZ
// {
// float x;
// float y;
// float z;
// };
int main(int argc, char** argv)
{
pcl::PointCloud cloud; // creating a struct named PointCloud
//Filling in cloud data
cloud.width = 5;
cloud.height = 1;
cloud.is_dense = false;
cloud.points.resize (cloud.width * cloud.height);
for (size_t i = 0; i < cloud.points.size(); ++i)
{
cloud.points[i].x = 1024 * rand() / (RAND_MAX + 1.0f);
cloud.points[i].y = 1024 * rand() / (RAND_MAX + 1.0f);
cloud.points[i].z = 1024 * rand() / (RAND_MAX + 1.0f);
}
pcl::io::savePCDFileASCII("test_pcd.pcd", cloud);
std::cerr << "Saved " << points.size() << " data points to test_pcd.pcd" << std::endl;
for (size_t i = 0; i < cloud.points.size (); ++i)
std::cerr << " " << points[i].x << points[i].y << " " << cloud.points[i].z << std::endl;
}
I haven’t setup OpenNI, so this is what cmake gives me:
$ cmake .
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- serialization
-- chrono
-- checking for module 'openni-dev'
-- package 'openni-dev' not found
-- Could NOT find openni (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
** WARNING ** io features related to openni will be disabled
-- checking for module 'openni2-dev'
-- package 'openni2-dev' not found
-- Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
** WARNING ** io features related to openni2 will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- checking for module 'openni-dev'
-- package 'openni-dev' not found
-- Could NOT find openni (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
** WARNING ** visualization features related to openni will be disabled
-- checking for module 'openni2-dev'
-- package 'openni2-dev' not found
-- Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
** WARNING ** visualization features related to openni2 will be disabled
-- checking for module 'openni-dev'
-- package 'openni-dev' not found
-- Could NOT find openni (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
** WARNING ** apps features related to openni will be disabled
-- looking for PCL_COMMON
-- looking for PCL_GEOMETRY
-- looking for PCL_OCTREE
-- looking for PCL_IO
-- looking for PCL_KDTREE
-- looking for PCL_SEARCH
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_FEATURES
-- looking for PCL_SEGMENTATION
-- looking for PCL_VISUALIZATION
-- looking for PCL_SURFACE
-- looking for PCL_REGISTRATION
-- looking for PCL_KEYPOINTS
-- looking for PCL_TRACKING
-- looking for PCL_RECOGNITION
-- looking for PCL_APPS
-- Could NOT find PCL_APPS (missing: PCL_APPS_LIBRARY)
-- looking for PCL_CLOUD_COMPOSER
-- looking for PCL_MODELER
-- looking for PCL_POINT_CLOUD_EDITOR
-- looking for PCL_OUTOFCORE
-- looking for PCL_PEOPLE
-- Configuring done
-- Generating done
-- Build files have been written to: path-here
Now to visualize this point cloud!
[ View3D.cpp ] [ vision course ]
I grabbed the single PCD viewer, and things workout, but I am having trouble exiting out of the visualizer window that comes up…