博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PCL是否安装成功测试(手把手超详细版)
阅读量:4167 次
发布时间:2019-05-26

本文共 1568 字,大约阅读时间需要 5 分钟。

PCL是否安装成功测试

建立一个test_pcl文件夹

在test_pcl文件夹下建一个test_pcl.cpp文档并写入:

#include 
#include
#include
#include
#include
#include
using namespace std; int main(int argc, char **argv) { //柱型点云测试 cout << "Test PCL !" << endl; pcl::PointCloud
::Ptr point_cloud_ptr (new pcl::PointCloud
); 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 = cos (pcl::deg2rad(angle)); point.y = sin (pcl::deg2rad(angle)); point.z = z; uint32_t rgb = (static_cast
(r) << 16 | static_cast
(g) << 8 | static_cast
(b)); point.rgb = *reinterpret_cast
(&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 ("pcl—test测试"); viewer.showCloud(point_cloud_ptr); while (!viewer.wasStopped()){ }; return 0;}

建立配置文件:CMakeLists.txt,写入:

cmake_minimum_required(VERSION 2.6)project(test_pcl) find_package(PCL 1.2 REQUIRED) include_directories(${
PCL_INCLUDE_DIRS})link_directories(${
PCL_LIBRARY_DIRS})add_definitions(${
PCL_DEFINITIONS}) add_executable(test_pcl test_pcl.cpp) target_link_libraries (test_pcl ${
PCL_LIBRARIES}) install(TARGETS test_pcl RUNTIME DESTINATION bin)

然后再在test_pcl文件夹下建一个build文件夹。

开始编译:
1、在build文件夹中打开终端(在文件夹下右键+T)
2、终端输入

cmake ..

3、终端输入

make

4、终端输入

./test_pcl

可得

在这里插入图片描述
说明安装成功!

转载地址:http://zjexi.baihongyu.com/

你可能感兴趣的文章
Mutex, semaphore, spinlock的深度解析
查看>>
pthread线程使用小结
查看>>
A Game of Thrones(59)
查看>>
2018.3.19
查看>>
A Game of Thrones(97)
查看>>
A Game of Thrones(98)
查看>>
2018.3.20
查看>>
2018.3.21
查看>>
2018.3.22
查看>>
2018.3.23
查看>>
A Game of Thrones(102)
查看>>
2018.4.29
查看>>
2018.4.30
查看>>
2018.4.31
查看>>
2018.4.32
查看>>
2018.4.33
查看>>
《python基础教程》答案(第一章)
查看>>
2018.4.34
查看>>
2018.4.35
查看>>
2018.4.36
查看>>