功能簡(jiǎn)介
open3d中點(diǎn)云的平移函數(shù)為:pcd.translate((tx, ty, tz), relative=True)。當(dāng)relative為T(mén)rue時(shí),(tx, ty, tz)表示點(diǎn)云平移的相對(duì)尺度,也就是平移了多少距離。當(dāng)relative為False時(shí),(tx, ty, tz)表示點(diǎn)云中心(質(zhì)心)平移到的指定位置。質(zhì)心可以坐標(biāo)可以通過(guò)pcd.get_center()得到。
代碼示例
參考代碼:
def open3d_translate():
pcd_path = r"E:\Study\Machine Learning\Dataset3d\points_pcd\cat.pcd"
pcd = open3d.io.read_point_cloud(pcd_path)
print('pcd center point: ', pcd.get_center())
pcd_translate = deepcopy(pcd)
pcd_translate.translate((50, 50, 50), relative=True)
print('pcd_translate center point: ', pcd_translate.get_center())
open3d.visualization.draw_geometries([pcd, pcd_translate], # 點(diǎn)云列表
window_name="Rabbit", # 窗口名稱
width=800,
height=600)
ps:使用translate進(jìn)行點(diǎn)云平移后,原始點(diǎn)云數(shù)據(jù)會(huì)發(fā)生變化。如果要用到平移之前的點(diǎn)云,那么需要復(fù)制一份原始點(diǎn)云進(jìn)行平移變換。這里輸出:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-814612.html
pcd center point: [ 1.05603759e-02 -5.09065193e+00 2.88664306e+01]
pcd_translate center point: [50.01056038 44.90934807 78.86643059]
圖像輸出?
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-814612.html
到了這里,關(guān)于open3d點(diǎn)云平移的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!