Mac配置pcl

Mercia ·
更新时间:2024-09-21
· 540 次阅读

配置直接利用brew install pcl进行安装,我这里安装后是pcl1.9版本,此过程可能需要翻墙。
安装完成利用brew info pcl查看安装情况,如果出现下图,说明安装完成。
在这里插入图片描述
如果某项出现❌,可以利用brew install ***进行重新安装。直到出现上图为止。

pcl实例:
这里以CMakeLists.txt为例:
项目目录:
demo
|__build
|__src
| |__main.cpp
|__CMakeLists.txt

CMakeLists.txt

cmake_minimum_required(VERSION 2.8 FATAL_ERROR) project(MY_GRAND_PROJECT) find_package(PCL 1.9 REQUIRED) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) add_executable(pcd_test src/main.cpp) target_link_libraries(pcd_test ${PCL_LIBRARIES})

main.cpp

// 显示实例 #include #include #include #include #include using namespace std; using namespace pcl; using namespace io; int main() { PointCloud::Ptr cloud (new PointCloud); io::loadPCDFile("pcd文件路径", *cloud); if (cloud==NULL) { cerr << "can't read file bunny.pcd" << endl; return -1; } boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer("3D Viewer")); pcl::visualization::PointCloudColorHandlerGenericField fildColor(cloud, "z"); // 按照z字段进行渲染 viewer->addPointCloud(cloud, fildColor, "sample cloud"); viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud"); // 设置点云大小 while (!viewer->wasStopped()) { viewer->spinOnce(100); boost::this_thread::sleep(boost::posix_time::microseconds(100000)); } return 0; }

源码下载链接:https://download.csdn.net/download/OEMT_301/12147794


作者:Joemt



pcl mac

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章