日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

Open3d学习计划—高级篇 3(点云全局配准)

發(fā)布時間:2023/11/27 生活经验 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Open3d学习计划—高级篇 3(点云全局配准) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Open3D是一個開源庫,支持快速開發(fā)和處理3D數(shù)據(jù)。Open3D在c++和Python中公開了一組精心選擇的數(shù)據(jù)結(jié)構(gòu)和算法。后端是高度優(yōu)化的,并且是為并行化而設(shè)置的。

本系列學(xué)習(xí)計劃有Blue同學(xué)作為發(fā)起人,主要以O(shè)pen3D官方網(wǎng)站的教程為主進行翻譯與實踐的學(xué)習(xí)計劃。點云PCL公眾號作為免費的3D視覺,點云交流社區(qū),期待有使用Open3D或者感興趣的小伙伴能夠加入我們的翻譯計劃,貢獻(xiàn)免費交流社區(qū),為使用Open3D提供中文的使用教程。

ICP配準(zhǔn)和彩色點云配準(zhǔn)都被稱為局部點云配準(zhǔn)方法,因為他們都依賴一個粗糙的對齊作為初始化。本篇教程將會展現(xiàn)另一種被稱為全局配準(zhǔn)的配準(zhǔn)方法.這種系列的算法不要求一個初始化的對齊,通常會輸出一個沒那么精準(zhǔn)的對齊結(jié)果,并且使用該結(jié)果作為局部配準(zhǔn)的初始化.

可視化

該輔助函數(shù)可以將配準(zhǔn)的源點云和目標(biāo)點云一起可視化。

def draw_registration_result(source, target, transformation):source_temp = copy.deepcopy(source)target_temp = copy.deepcopy(target)source_temp.paint_uniform_color([1, 0.706, 0])target_temp.paint_uniform_color([0, 0.651, 0.929])source_temp.transform(transformation)o3d.visualization.draw_geometries([source_temp, target_temp])
?

注意:這里原來的教程里可視化函數(shù)都加了初始視角之類的,但是很多人反映這個會報錯,并且官方函數(shù)里也沒給出可接受的參數(shù),所以在這里把初始視角的參數(shù)都去掉了

提取幾何特征

我們降采樣點云,估計法線,之后對每個點計算FPFH特征.FPFH特征是一個描述點的局部幾何屬性的33維的向量.在33維空間中進行最近鄰查詢可以返回具有近似幾何結(jié)構(gòu)的點.詳細(xì)細(xì)節(jié)請查看?[Rasu2009].

def preprocess_point_cloud(pcd, voxel_size):print(":: Downsample with a voxel size %.3f." % voxel_size)pcd_down = pcd.voxel_down_sample(voxel_size)radius_normal = voxel_size * 2print(":: Estimate normal with search radius %.3f." % radius_normal)pcd_down.estimate_normals(o3d.geometry.KDTreeSearchParamHybrid(radius=radius_normal, max_nn=30))radius_feature = voxel_size * 5print(":: Compute FPFH feature with search radius %.3f." % radius_feature)pcd_fpfh = o3d.registration.compute_fpfh_feature(pcd_down,o3d.geometry.KDTreeSearchParamHybrid(radius=radius_feature, max_nn=100))return pcd_down, pcd_fpfh

輸入

以下代碼從兩個文件中讀取源點云和目標(biāo)點云.這一對點云使用單位矩陣作為初始矩陣之后是不對齊的.

def prepare_dataset(voxel_size):print(":: Load two point clouds and disturb initial pose.")source = o3d.io.read_point_cloud("../../TestData/ICP/cloud_bin_0.pcd")target = o3d.io.read_point_cloud("../../TestData/ICP/cloud_bin_1.pcd")trans_init = np.asarray([[0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0],[0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]])source.transform(trans_init)draw_registration_result(source, target, np.identity(4))source_down, source_fpfh = preprocess_point_cloud(source, voxel_size)target_down, target_fpfh = preprocess_point_cloud(target, voxel_size)return source, target, source_down, target_down, source_fpfh, target_fpfhvoxel_size = 0.05 # means 5cm for this dataset
source, target, source_down, target_down, source_fpfh, target_fpfh = prepare_dataset(voxel_size)

:: Load two point clouds and disturb initial pose.
:: Downsample with a voxel size 0.050.
:: Estimate normal with search radius 0.100.
:: Compute FPFH feature with search radius 0.250.
:: Downsample with a voxel size 0.050.
:: Estimate normal with search radius 0.100.
:: Compute FPFH feature with search radius 0.250.

RANSAC

我們使用RANSAC進行全局配準(zhǔn).在RANSAC迭代中,我們每次從源點云中選取 ransac_n 個隨機點.通過在33維FPFH特征空間中查詢最鄰近,可以在目標(biāo)點云中找到他們的對應(yīng)點.剪枝步驟需要使用快速修剪算法來提早拒絕錯誤匹配.
Open3d提供以下剪枝算法:

  • CorrespondenceCheckerBasedOnDistance檢查對應(yīng)的點云是否接近(也就是距離是否小于指定閾值)

  • CorrespondenceCheckerBasedOnEdgeLength檢查從源點云和目標(biāo)點云對應(yīng)中分別畫上兩條任意邊(兩個頂點連成的線)是否近似.

  • CorrespondenceCheckerBasedOnNormal考慮的所有的對應(yīng)的頂點法線的密切關(guān)系.他計算了兩個法線向量的點積.使用弧度作為閾值.

只有通過剪枝步驟的匹配才用于轉(zhuǎn)換,該轉(zhuǎn)換將在整個點云上進行驗證.核心函數(shù)是 :

registration_ransac_based_on_feature_matching.?

RANSACConvergenceCriteria是里面一個十分重要的超參數(shù).他定義了RANSAC迭代的最大次數(shù)和驗證的最大次數(shù).這兩個值越大,那么結(jié)果越準(zhǔn)確,但同時也要花費更多的時間.
我們是基于[Choi2015]提供的的經(jīng)驗來設(shè)置RANSAC的超參數(shù).

def execute_global_registration(source_down, target_down, source_fpfh,target_fpfh, voxel_size):distance_threshold = voxel_size * 1.5print(":: RANSAC registration on downsampled point clouds.")print("   Since the downsampling voxel size is %.3f," % voxel_size)print("   we use a liberal distance threshold %.3f." % distance_threshold)result = o3d.registration.registration_ransac_based_on_feature_matching(source_down, target_down, source_fpfh, target_fpfh, distance_threshold,o3d.registration.TransformationEstimationPointToPoint(False), 4, [o3d.registration.CorrespondenceCheckerBasedOnEdgeLength(0.9),o3d.registration.CorrespondenceCheckerBasedOnDistance(distance_threshold)], o3d.registration.RANSACConvergenceCriteria(4000000, 500))return result
result_ransac = execute_global_registration(source_down, target_down,source_fpfh, target_fpfh,voxel_size)
print(result_ransac)
draw_registration_result(source_down, target_down, result_ransac.transformation)

:: RANSAC registration on downsampled point clouds.
Since the downsampling voxel size is 0.050,
we use a liberal distance threshold 0.075.
registration::RegistrationResult with fitness=6.773109e-01, inlier_rmse=3.332039e-02, and correspondence_set size of 3224
Access transformation to get result.

局部優(yōu)化

由于性能原因,全局配準(zhǔn)只能在大規(guī)模降采樣的點云上執(zhí)行,配準(zhǔn)的結(jié)果不夠精細(xì),我們使用?Point-to-plane ICP?去進一步優(yōu)化配準(zhǔn)結(jié)果.

def refine_registration(source, target, source_fpfh, target_fpfh, voxel_size):distance_threshold = voxel_size * 0.4print(":: Point-to-plane ICP registration is applied on original point")print("   clouds to refine the alignment. This time we use a strict")print("   distance threshold %.3f." % distance_threshold)result = o3d.registration.registration_icp(source, target, distance_threshold, result_ransac.transformation,o3d.registration.TransformationEstimationPointToPlane())return resultresult_icp = refine_registration(source, target, source_fpfh, target_fpfh,voxel_size)
print(result_icp)
draw_registration_result(source, target, result_icp.transformation)

:: Point-to-plane ICP registration is applied on original point
clouds to refine the alignment. This time we use a strict
distance threshold 0.020.
registration::RegistrationResult with fitness=6.210275e-01, inlier_rmse=6.565175e-03, and correspondence_set size of 123482
Access transformation to get result.

快速全局配準(zhǔn)

由于無數(shù)的模型推薦和評估,導(dǎo)致基于RANSAC的全局配準(zhǔn)需要很長的時間.
[Zhou2016]?提出了一種加速的方法,該方法可以快速的優(yōu)化幾乎沒有對應(yīng)關(guān)系的線處理權(quán)重( [Zhou2016] introduced a faster approach that quickly optimizes line process weights of few correspondences).這樣在每次迭代的時候沒有模型建議和評估,該方法就在計算的時候節(jié)約的大量的時間.(建議看看原論文,這個感覺翻譯不好,有更好建議的歡迎留言.)
這篇教程比較了基于RANSAC的全局配準(zhǔn)和[Zhou2016]方法的運行時間.

輸入

我們使用上面全局配準(zhǔn)的輸入例子.

voxel_size = 0.05  # means 5cm for the dataset
source, target, source_down, target_down, source_fpfh, target_fpfh = \prepare_dataset(voxel_size)

:: Load two point clouds and disturb initial pose.
:: Downsample with a voxel size 0.050.
:: Estimate normal with search radius 0.100.
:: Compute FPFH feature with search radius 0.250.
:: Downsample with a voxel size 0.050.
:: Estimate normal with search radius 0.100.
:: Compute FPFH feature with search radius 0.250.

基準(zhǔn)

在下面代碼中,我們將計時全局配準(zhǔn)算法.

start = time.time()
result_ransac = execute_global_registration(source_down, target_down,source_fpfh, target_fpfh,voxel_size)
print("Global registration took %.3f sec.\n" % (time.time() - start))
print(result_ransac)
draw_registration_result(source_down, target_down,result_ransac.transformation)

:: RANSAC registration on downsampled point clouds.
Since the downsampling voxel size is 0.050,
we use a liberal distance threshold 0.075.
Global registration took 0.085 sec.
registration::RegistrationResult with fitness=6.760504e-01, inlier_rmse=2.596653e-02, and correspondence_set size of 3218
Access transformation to get result.

快速全局配準(zhǔn)

我們采用和基準(zhǔn)相同的輸入,下面的代碼調(diào)用了了[Zhou2016]的實現(xiàn).

def execute_fast_global_registration(source_down, target_down, source_fpfh,target_fpfh, voxel_size):distance_threshold = voxel_size * 0.5print(":: Apply fast global registration with distance threshold %.3f" \% distance_threshold)result = o3d.registration.registration_fast_based_on_feature_matching(source_down, target_down, source_fpfh, target_fpfh,o3d.registration.FastGlobalRegistrationOption(maximum_correspondence_distance=distance_threshold))return?result
start = time.time()
result_fast = execute_fast_global_registration(source_down, target_down,source_fpfh, target_fpfh,voxel_size)
print("Fast global registration took %.3f sec.\n" % (time.time() - start))
print(result_fast)
draw_registration_result(source_down, target_down,result_fast.transformation)

:: Apply fast global registration with distance threshold 0.025
Fast global registration took 0.128 sec.
registration::RegistrationResult with fitness=5.054622e-01, inlier_rmse=1.743545e-02, and correspondence_set size of 2406
Access transformation to get result.

經(jīng)過適當(dāng)?shù)呐渲?快速全局配準(zhǔn)的精度甚至可以和ICP相媲美.更多實驗結(jié)果請參閱[Zhou2016].

資源

三維點云論文及相關(guān)應(yīng)用分享

【點云論文速讀】基于激光雷達(dá)的里程計及3D點云地圖中的定位方法

3D目標(biāo)檢測:MV3D-Net

三維點云分割綜述(上)

3D-MiniNet: 從點云中學(xué)習(xí)2D表示以實現(xiàn)快速有效的3D LIDAR語義分割(2020)

win下使用QT添加VTK插件實現(xiàn)點云可視化GUI

JSNet:3D點云的聯(lián)合實例和語義分割

大場景三維點云的語義分割綜述

PCL中outofcore模塊---基于核外八叉樹的大規(guī)模點云的顯示

基于局部凹凸性進行目標(biāo)分割

基于三維卷積神經(jīng)網(wǎng)絡(luò)的點云標(biāo)記

點云的超體素(SuperVoxel)

基于超點圖的大規(guī)模點云分割

更多文章可查看:點云學(xué)習(xí)歷史文章大匯總

SLAM及AR相關(guān)分享

【開源方案共享】ORB-SLAM3開源啦!

【論文速讀】AVP-SLAM:自動泊車系統(tǒng)中的語義SLAM

【點云論文速讀】StructSLAM:結(jié)構(gòu)化線特征SLAM

SLAM和AR綜述

常用的3D深度相機

AR設(shè)備單目視覺慣導(dǎo)SLAM算法綜述與評價

SLAM綜述(4)激光與視覺融合SLAM

Kimera實時重建的語義SLAM系統(tǒng)

SLAM綜述(3)-視覺與慣導(dǎo),視覺與深度學(xué)習(xí)SLAM

易擴展的SLAM框架-OpenVSLAM

高翔:非結(jié)構(gòu)化道路激光SLAM中的挑戰(zhàn)

SLAM綜述之Lidar SLAM

基于魚眼相機的SLAM方法介紹

往期線上分享錄播匯總

第一期B站錄播之三維模型檢索技術(shù)

第二期B站錄播之深度學(xué)習(xí)在3D場景中的應(yīng)用

第三期B站錄播之CMake進階學(xué)習(xí)

第四期B站錄播之點云物體及六自由度姿態(tài)估計

第五期B站錄播之點云深度學(xué)習(xí)語義分割拓展

第六期B站錄播之Pointnetlk解讀

[線上分享錄播]點云配準(zhǔn)概述及其在激光SLAM中的應(yīng)用

[線上分享錄播]cloudcompare插件開發(fā)

[線上分享錄播]基于點云數(shù)據(jù)的?Mesh重建與處理

[線上分享錄播]機器人力反饋遙操作技術(shù)及機器人視覺分享

[線上分享錄播]地面點云配準(zhǔn)與機載點云航帶平差

點云PCL更多活動請查看:點云PCL活動之應(yīng)屆生校招群

掃描下方微信視頻號二維碼可查看最新研究成果及相關(guān)開源方案的演示:

如果你對Open3D感興趣,或者正在使用該開源方案,就請加入我們,一起翻譯,一起學(xué)習(xí),貢獻(xiàn)自己的力量,目前階段主要以微信群為主,有意者發(fā)送“Open3D學(xué)習(xí)計劃”到公眾號后臺,和更多熱愛分享的小伙伴一起交流吧!如果翻譯的有什么問題或者您有更好的意見,請評論交流!!!!

以上內(nèi)容如有錯誤請留言評論,歡迎指正交流。如有侵權(quán),請聯(lián)系刪除

掃描二維碼

? ? ? ? ? ? ? ? ? ?關(guān)注我們

讓我們一起分享一起學(xué)習(xí)吧!期待有想法,樂于分享的小伙伴加入免費星球注入愛分享的新鮮活力。分享的主題包含但不限于三維視覺,點云,高精地圖,自動駕駛,以及機器人等相關(guān)的領(lǐng)域。

分享及合作方式:微信“920177957”(需要按要求備注) 聯(lián)系郵箱:dianyunpcl@163.com,歡迎企業(yè)來聯(lián)系公眾號展開合作。

點一下“在看”你會更好看耶

總結(jié)

以上是生活随笔為你收集整理的Open3d学习计划—高级篇 3(点云全局配准)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。