window系统配置PCL的简化方法(不需要复制一百多个依赖项目名称,直接导入配置表)

1.下载文件

百度网盘:
链接:https://pan.baidu.com/s/1WQQ8kaDilaagjoK5IrYZzA 
提取码:1111 

注意:直接解压在E盘!!!!!
不解压在E盘也可以,后续替换环境变量和属性表文件内的地址就行(props文件)
 


2.配置环境变量

点击电脑 设置
搜索编辑系统环境变量
点击Path
添加如下变量
E:PCL1.11.0bin
E:PCL1.11.03rdPartyVTKbin
E:PCL1.11.03rdPartyOpenNI2Redist
E:PCL1.11.03rdPartyFLANNbin


3.Visual Studio配置属性表

1.创建空白C++新项目

注:x86改成x64

添加属性表
视图->其他窗口->资源管理器
右键Debug|x64->添加现有属性表->添加pcl1_11_x64_debug.props(在下载解压后的文件夹里)
右键Release|x64->添加现有属性表->添加pcl1_11_x64_release.props(在下载解压后的文件夹里)
 

4测试

点击解决方案资源管理器->右键源文件->添加->新建项
添加c++文件

黏贴测试代码

#include <iostream>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/console/parse.h>


int main(int argc, char** argv) {
    std::cout << "Test PCL !!!" << std::endl;

    pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr(new pcl::PointCloud<pcl::PointXYZRGB>);
    uint8_t r(255), g(15), b(15);
    for (float z(-1.0); z <= 1.0; z += 0.05)
    {
        for (float angle(0.0); angle <= 360.0; angle += 5.0)
        {
            pcl::PointXYZRGB point;
            point.x = 0.5 * cosf(pcl::deg2rad(angle));
            point.y = sinf(pcl::deg2rad(angle));
            point.z = z;
            uint32_t rgb = (static_cast<uint32_t>(r) << 16 |
                static_cast<uint32_t>(g) << 8 | static_cast<uint32_t>(b));
            point.rgb = *reinterpret_cast<float*>(&rgb);
            point_cloud_ptr->points.push_back(point);
        }
        if (z < 0.0)
        {
            r -= 12;
            g += 12;
        }
        else
        {
            g -= 12;
            b += 12;
        }
    }
    point_cloud_ptr->width = (int)point_cloud_ptr->points.size();
    point_cloud_ptr->height = 1;

    pcl::visualization::CloudViewer viewer("test");
    viewer.showCloud(point_cloud_ptr);
    while (!viewer.wasStopped()) {};
    return 0;
}

该程序生成椭圆柱面点云,并沿轴向赋色

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>