PCL (Point Cloud Library) is getting more popular these days. It's good for Kinect users and might be also helpful for visualization usages as well.
I used to attempt to install the PCL, couple months ago, however at that time it's not very successful. This time, it works. For my record and for others who may interested, I will list the details below.
1. Following the instruction in:
http://pointclouds.org/documentation/tutorials/compiling_pcl_macosx.php#compiling-pcl-macosx
till installing Qhull.
2. Install and download libusb, openNI and sense from the following webpage ( do
not install libusb from macports):
http://pointclouds.org/downloads/macosx.html
3. Build PCL as the instruction in Step 1 webpage.
The first project in Xcode:
0.1 Switch Compiler for C/C++/Objective-C from Apple LLVM compiler 4.2 -> LLVM GCC 4.2
1. adding the following entries into "Header Search Paths"
1.1 /usr/local/include/pcl-1.7
1.2 /opt/local/include
1.3 /opt/local/include/eigen3
1.4 /opt/local/include/vtk-5.10
2. Adding "New Group", named: boost, right-click new created "boost" folder, and Add File to project:
locate file: /opt/local/lib/libboost_system-mt.dylib
3. Adding "New Group", named: pcl, right-click new created "pcl" folder, and Add File to project:
locate file: ($whereBuildPCL)/build/lib/libpcl_io.1.7.0.dylib, and ($whereBuildPCL)/build/lib/libpcl_common.1.7.0.dylib
4. input the following script into main.cpp
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
int main(int argc, const char * argv[])
{
pcl::PointCloud<pcl::PointXYZ> cloud;
// fill in the 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 " << cloud.points.size() << " data points to test_pcd.pcd." << std::endl;
for (size_t i = 0; i < cloud.points.size(); ++i)
std::cerr << " " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;
return 0;
}
5. Find out the output .pcd file
5.1 Open Organizer: (Window->Organizer)
5.2 find your Projects, right click the right arrow next to your "Derived Data"
5.3 Build/Products/Debug/test_pcd.pcd