【点云重采样Resampling】Python-pcl 基于多项式平滑点云及法线估计的曲面重建
生活随笔
收集整理的這篇文章主要介紹了
【点云重采样Resampling】Python-pcl 基于多项式平滑点云及法线估计的曲面重建
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1. 點(diǎn)云重采樣
基于多項(xiàng)式平滑點(diǎn)云及法線估計(jì)的曲面重建以實(shí)現(xiàn)重采樣,可以使得點(diǎn)云數(shù)據(jù)更規(guī)整一些,沒之前那么雜亂。
- set_Compute_Normals(True) 可以通過在最小二乘法中進(jìn)行法線估計(jì),提高重采樣準(zhǔn)確度;
- set_polynomial_fit(True) 可以通過不需要多項(xiàng)式擬合來加快平滑速度,設(shè)置為True則在整個(gè)算法運(yùn)行時(shí)采用多項(xiàng)式擬合來提高精度;
2. 效果如下:
重建前:
正面:
側(cè)面:
重建后:
正面:
側(cè)面:
可以看到重采樣后點(diǎn)云的形狀清晰了許多。
3. 源碼
# -*- coding: utf-8 -*-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
# <基于多項(xiàng)式平滑點(diǎn)云及法線估計(jì)的曲面重建重采樣,使得數(shù)據(jù)更規(guī)整一些,沒之前那么雜亂>Smoothing and normal estimation based on polynomial reconstructionhttp://pointclouds.org/documentation/tutorials/resampling.php#moving-least-squares
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
import pcldef main():# 加載點(diǎn)云cloud = pcl.load('D:/tests/examples/official/Surface/bun0.pcd')print('cloud(size) = ' + str(cloud.size))# 構(gòu)建kd樹tree = cloud.make_kdtree()# 重建mls = cloud.make_moving_least_squares()print('make_moving_least_squares')mls.set_Compute_Normals(True) # 設(shè)置在最小二乘計(jì)算中需要進(jìn)行法線估計(jì)mls.set_polynomial_fit(True) # 可以通過不需要多項(xiàng)式擬合來加快平滑速度,設(shè)置為true時(shí)則在整個(gè)算法運(yùn)行時(shí)采用多項(xiàng)式擬合來提高精度mls.set_Search_Method(tree)mls.set_search_radius(0.03)print('set parameters')mls_points = mls.process()print('mls_points(size) = ' + str(mls_points.size))# 存儲重采樣結(jié)果pcl.save_PointNormal(mls_points,'D:/tests/examples/official/Surface/bun0-mls-nonormas.pcd')if __name__ == "__main__":main()
參考:
- http://pointclouds.org/documentation/tutorials/resampling.php#moving-least-squares
總結(jié)
以上是生活随笔為你收集整理的【点云重采样Resampling】Python-pcl 基于多项式平滑点云及法线估计的曲面重建的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用错了表情是哪首歌啊?
- 下一篇: Open3D KdTree建立、3种近邻