点云配准:Open3D手动选点配准工具

本文详细介绍了如何使用Open3D进行手动点云配准,包括源码获取、编译过程、使用步骤,适用于Windows10和Ubuntu1804环境。通过选择关键点并执行刚体变换计算,实现点云的精确配准。
摘要由CSDN通过智能技术生成

写在前面

  • 本文内容

    • Open3D手动选点配准工具;
    • 包含CMakeLists,cpp源码,编译脚本,运行结果可视化,可执行文件;
    • 源码、编译好的工具和脚本在这里下载:
      本博客资源链接/share_noel/csdn/open3d/open3d_ManuallyAlignPointCloud
      在这里插入图片描述
  • 运行结果在这里插入图片描述

  • 平台/环境
    Windows10, Ubuntu1804, CMake, Open3D

  • 转载请注明出处:
    https://blog.csdn.net/qq_41102371/article/details/136840171

准备Open3D

参考:各个版本的Open3D、PCL的编译、使用教程
本文使用Open3D0.14.1

代码

源码

找到open3d源码中手动配准的源码,在Open3D0.14.1/Open3D/cpp/tools/ManuallyAlignPointCloud
在这里插入图片描述
新建一个文件夹open3d_ManuallyAlignPointCloud/src

mkdir open3d_ManuallyAlignPointCloud
cd open3d_ManuallyAlignPointCloud
mkdir src

将找到的代码复制到src中

编译

vscode打开open3d_ManuallyAlignPointCloud,修改src/CMakeLists.txt,其中"D:/carlos/install/source_code/Open3D/Open3D0.14.1/Open3D/3rdparty/tinyfiledialogs/include"需要改成你本地的open3d源码的对应位置
在这里插入图片描述
CMakeLists.txt

cmake_minimum_required(VERSION 3.19.2)
project(ManualAlign)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(CMAKE_BUILD_TYPE "Release")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")

# The options need to be the same as Open3D's default
# If Open3D is configured and built with custom options, you'll also need to
# specify the same custom options.
option(STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" ON)
if(STATIC_WINDOWS_RUNTIME)
    set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
    set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()

find_package(Open3D REQUIRED)

message(${Open3D_INCLUDE_DIRS})
include_directories(
  ${Open3D_INCLUDE_DIRS}
  ${PROJECT_SOURCE_DIR}
  ${JSONCPP_DIR}/include
  "D:/carlos/install/source_code/Open3D/Open3D0.14.1/Open3D/3rdparty/tinyfiledialogs/include"
  )

add_executable(ManuallyAlignPointCloud)

target_sources(ManuallyAlignPointCloud PRIVATE
    ManuallyAlignPointCloud.cpp
    AlignmentSession.cpp
    VisualizerForAlignment.cpp
)
target_link_libraries(ManuallyAlignPointCloud PRIVATE
    Open3D::Open3D
    Open3D::3rdparty_jsoncpp
    Open3D::3rdparty_tinyfiledialogs
)
# set_target_properties(ManuallyAlignPointCloud PROPERTIES FOLDER "Tools")
# open3d_show_and_abort_on_warning(ManuallyAlignPointCloud)
# open3d_set_global_properties(ManuallyAlignPointCloud)

添加编译脚本:
在这里插入图片描述

compile.bat

rem By carlos_lee 202403
rem rd /s /q .\build
cmake -DOpen3D_DIR="D:/carlos/install/open3d141/CMake" ^
-DJSONCPP_DIR="D:/carlos/install/jsoncpp" ^
-S ./src . -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build --config Release --target ALL_BUILD
mkdir bin
copy .\build\Release\ManuallyAlignPointCloud.exe .\bin

其中,DOpen3D_DIR是你编译好的open3d的安装路径,json见jsoncpp+cmake使用

编译
在这里插入图片描述

使用

具体的操作在代码里都写了,这些就是用来控制键盘回调函数的,在source和target分别按顺序选四个点,然后在alignment窗口点一下,ctrl+a就执行点对的刚体变换计算了,ctrl+r是重置点云位姿
在这里插入图片描述
选点操作:如果没用过open3d选点操作的,shift+左键是选一个点,shift+右键是取消上一个点的选择,在可视化窗口中(英文状态下)输入h,就会有cmd输出说明
在这里插入图片描述
添加运行脚本run_manualAlign.bat

.\bin\ManuallyAlignPointCloud.exe ^
D:\carlos\my_tools\data\bunny\data\bun045.ply ^
D:\carlos\my_tools\data\bunny\data\bun000.ply ^
--without_scaling --voxel_size 0.01 --max_corres_distance 0.05

其中,第二三行分别是你本地source和target点云的路径
运行
在这里插入图片描述
源码、编译好的工具和脚本在这里下载:
本博客资源链接/share_noel/csdn/open3d/open3d_ManuallyAlignPointCloud

下面就是操作示例
在这里插入图片描述

参考

文中已列出

主要做激光/影像三维重建,配准、分割等常用点云算法,熟悉open3d、pcl等开源点云库,技术交流、咨询可私信

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

诺有缸的高飞鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值