【PCL】x64+VS2013+PCL1.7.2 简便安装与常见LNK2019问题

感谢Tsuksa Sugiura

本文使用的安装程序已搬运到墙内
百度云链接 密码:hsw1

版本:2015/03/18

  • PCL 1.7.2 release
  • Boost 1.57.0
  • Eigen 3.2.4
  • FLANN 1.8.4
  • VTK 6.2.0
  • QHull 2012.1

安装
修改系统环境变量

添加PCL_ROOT
值为PCL安装位置
修改Path
添加;%PCL_ROOT%\bin;%PCL_ROOT%\3rdParty\FLANN\bin;%PCL_ROOT%\3rdParty\VTK\bin

打开vs2013,新建C++空项目,直接添加cpp文件
或复制如下代码

#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>


int user_data;

void viewerOneOff(pcl::visualization::PCLVisualizer& viewer)
{
    viewer.setBackgroundColor(1.0, 0.5, 1.0);
    pcl::PointXYZ o;
    o.x = 1.0;
    o.y = 0;
    o.z = 0;
    viewer.addSphere(o, 0.25, "sphere", 0);
    std::cout << "i only run once" << std::endl;

}

void viewerPsycho(pcl::visualization::PCLVisualizer& viewer)
{
    static unsigned count = 0;
    std::stringstream ss;
    ss << "Once per viewer loop: " << count++;
    viewer.removeShape("text", 0);
    viewer.addText(ss.str(), 200, 300, "text", 0);

    //FIXME: possible race condition here:
    user_data++;
}

int main()
{
    pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
    pcl::io::loadPCDFile("example.pcd的位置", *cloud);

    pcl::visualization::CloudViewer viewer("Cloud Viewer");

    //blocks until the cloud is actually rendered
    viewer.showCloud(cloud);

    //use the following functions to get access to the underlying more advanced/powerful
    //PCLVisualizer

    //This will only get called once
    viewer.runOnVisualizationThreadOnce(viewerOneOff);

    //This will get called once per visualization iteration
    viewer.runOnVisualizationThread(viewerPsycho);
    while (!viewer.wasStopped())
    {
        //you can also do cool processing here
        //FIXME: Note that this is running in a separate thread from viewerPsycho
        //and you should guard against race conditions yourself...
        user_data++;
    }
    return 0;
}


选择下载的PCL.props

运行,效果如下:
【PCL】x64+VS2013+PCL1.7.2 简便安装与常见LNK2019问题_第1张图片

—————————————————————————————

2015.05.08更新
常见错误 LNK2019: 无法解析的外部符号

1.确实是包含文件 库文件目录写错了
2.没安装在默认目录
我遇到 安装在其他盘,然后 error LNK2019error C2039的情况了
3.安装版本不对
系统32位,安装的是64的。包诸如此类

—————————————————————————————
2015.05.14 更新
关于没有OpenNI

原博主的说法是:

  • Grabber

    This PCL All-in-one Installer does not include the OpenNI v1.x.

    For this reason, pcl::OpenNIGrabber is not available.(OpenNI v1.x support until the Visual Studio 2010.)
    However, I publish the Grabber that depends only on the Kinect for Windows SDK v1.x / v2.x.
    You can easy to use the Kinect sensor with PCL using KinectGrabber / Kinect2Grabber.
    KinectGrabber based on Kinect SDK v1.x | GitHub
    Kinect2Grabber based on Kinect SDK v2.x | GitHub

  • HOW TO USE KINECTGRABBER/KINECT2GRABBER WITH PCL::VISUALIZATION::PCLVISUALIZER

    pcl::visualization::PCLVisualizer is PCL’s full-featured visualisation class.
    While more complex to use than the >pcl::visualization::CloudViewer, it is also more powerful, offering features such as displaying normals, drawing shapes and multiple viewports.
    Drawing the Point Cloud using PCLVisualizer with KinectGrabber
    Drawing the Point Cloud using PCLVisualizer with Kinect2Grabber

  • 关于原因

“PCL 1.7.2 seems not stable when including OpenNI2.
I have updated the PCL All-in-one Installer without OpenNI2. (OpenNI2Grabber is not available. You can use Kinect/Kinect2 Grabber).”

  • KinectGrabber / Kinect2Grabberde的使用:
//#include <pcl/io/openni_grabber.h>
#include "kinect_grabber.h"

//pcl::Grabber* interface = new pcl::OpenNIGrabber();
pcl::Grabber* interface = new pcl::KinectGrabber();
//#include <pcl/io/openni_grabber.h>
#include "kinect2_grabber.h"

//pcl::Grabber* interface = new pcl::OpenNIGrabber();
pcl::Grabber* interface = new pcl::Kinect2Grabber();

你可能感兴趣的:(PCL)