根据open3d官网的教程确定gcc5+ clang7+ cmake3.19+ 的版本限制,不满足要求的要升级一下:
参考链接:
cmake升级
clang升级
按照链接Ubuntu 18.04 安装Open3D C++版本的安装部分依次操作即可
升级cmake,cmake升级
升级clang,clang升级
网络问题。
(1)配置clash:ubuntu18.04 配置clash(设置了私密,需要私我)
(2)如果仍然不能解决,手动下载相关包,并放置在dst指示的地址中:参考解决安装open3d下载失败问题
测试程序:
main.cpp
#include <iostream>
#include <memory>
#include <thread>
#include </usr/local/include/open3d/Open3D.h>int main(int argc, char * argv[]) {std::cout << "Hello, Open3D!! " << std::endl;open3d::utility::SetVerbosityLevel(open3d::utility::VerbosityLevel::Debug);auto pcd = open3d::io::CreatePointCloudFromFile(argv[1]);// 1. test downsampleauto downsampled = pcd->VoxelDownSample(0.05);{open3d::utility::ScopeTimer timer("FPFH estimation with Radius 0.25");open3d::pipelines::registration::ComputeFPFHFeature(*downsampled, open3d::geometry::KDTreeSearchParamRadius(0.25));}// 2. 估计点云的法向量{open3d::utility::ScopeTimer timer("Normal estimation with KNN20");for (int i = 0; i < 20; i++){downsampled->EstimateNormals(open3d::geometry::KDTreeSearchParamKNN(20));}}std::cout << downsampled->normals_[0] << std::endl;std::cout << downsampled->normals_[10] << std::endl;{open3d::utility::ScopeTimer timer("Normal estimation with Radius 0.01666");for(int i=0; i<20; i++){downsampled->EstimateNormals(open3d::geometry::KDTreeSearchParamRadius(0.01666));}}std::cout << downsampled->normals_[0] << std::endl;std::cout << downsampled->normals_[10] << std::endl;open3d::visualization::DrawGeometries({downsampled}, "TestPCD", 1920, 1080);return 0;
}
修改:
(1)#include <open3d/Open3D.h>改成#include </usr/local/include/open3d/Open3D.h>,否则会报错找不到头文件;
(2)open3d::registration::ComputeFPFHFeature(*downsampled, open3d::geometry::KDTreeSearchParamRadius(0.25));改成 open3d::pipelines::registration::ComputeFPFHFeature(*downsampled, open3d::geometry::KDTreeSearchParamRadius(0.25));
<
cmake_minimum_required(VERSION 2.8)
project(open3d_test)set(CMAKE_CXX_STANDARD 11)find_package( Open3D REQUIRED)include_directories(${Open3D_INCLUDE_DIRS})
link_directories(${Open3D_LIBRARY_DIRS})add_executable(TestVisualizer main.cpp)
target_link_libraries(TestVisualizer ${Open3D_LIBRARIES})target_include_directories(TestVisualizer PUBLIC ${Open3D_INCLUDE_DIRS})
运行结果:
本文发布于:2024-01-31 20:36:50,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170670461131188.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |