[python][pcl]python-pcl案例之基于多项式重构的平滑和正态估计重采样

news/2024/10/17 22:22:37/

测试环境:

pcl==1.12.1

python-pcl==0.3.1

python==3.7

代码:

# -*- coding: utf-8 -*-
# Smoothing and normal estimation based on polynomial reconstruction
# http://pointclouds.org/documentation/tutorials/resampling.php#moving-least-squaresimport numpy as np
import pcl
import randomdef main():# // Load input file into a PointCloud<T> with an appropriate type# pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ> ());# // Load bun0.pcd -- should be available with the PCL archive in test# pcl::io::loadPCDFile ("bun0.pcd", *cloud);cloud = pcl.load('bun0.pcd')print('cloud(size) = ' + str(cloud.size))# // Create a KD-Tree# pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);tree = cloud.make_kdtree()# tree = cloud.make_kdtree_flann()# blankCloud = pcl.PointCloud()# tree = blankCloud.make_kdtree()# // Output has the PointNormal type in order to store the normals calculated by MLS# pcl::PointCloud<pcl::PointNormal> mls_points;# mls_points = pcl.PointCloudNormal()# // Init object (second point type is for the normals, even if unused)# pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;# mls.setComputeNormals (true);## // Set parameters# mls.setInputCloud (cloud);# mls.setPolynomialFit (true);# mls.setSearchMethod (tree);# mls.setSearchRadius (0.03);## // Reconstruct# mls.process (mls_points);mls = cloud.make_moving_least_squares()# print('make_moving_least_squares')mls.set_Compute_Normals(True)mls.set_polynomial_fit(True)mls.set_Search_Method(tree)mls.set_search_radius(0.03)print('set parameters')mls_points = mls.process()# Save output# pcl::io::savePCDFile ("bun0-mls.pcd", mls_points);pcl.save_PointNormal(mls_points, 'bun0-mls.pcd')if __name__ == "__main__":# import cProfile# cProfile.run('main()', sort='time')main()

运行结果:

cloud(size) = 112586
set parameters

bun0.pcd文件需要去这个地址下载:https://github.com/strawlab/python-pcl/blob/master/examples/official/Surface/bun0.pcd


http://www.ppmy.cn/news/735054.html

相关文章

Win10系统无法安装字体显示字体无效

原因&#xff1a;没有启动防火墙服务&#xff0c;启动防火墙服务就可以了。我的是这个问题&#xff0c;可能有其他情况。

win10 安装字体且不占用系统盘资源

作为一个21世纪的新青年&#xff0c;电脑里怎么阔以只有那些沉闷的老旧字体呢&#xff0c;快跟进安装blingbling个性飘逸的时尚字体吧&#xff01; 如下&#xff1a;三步足矣~ 1. 首先在非系统盘建一个专门存字体的文件夹&#xff1a;将欲安装字体存进去 2. 控制面板<外观…

计算机字体安装按钮灰色,解决方案:在win10系统上将字体的安装按钮显示为灰色的详细步骤...

作为大多数用户使用的win10系统&#xff0c;如果win10系统中的字体安装按钮显示为灰色&#xff0c;那么我肯定遇到了win10系统中字体安装按钮显示为灰色的情况&#xff0c;该怎么办win10系统&#xff1f;无法安装字体&#xff0c;并且安装按钮为灰色&#xff1f;根据1、&#x…

win10字体安装_使用快捷方式安装字体,节省C盘空间,提高win操作系统运行速度...

在日常办公中,为了让文档排版美观,我们往往要给电脑安装很多字体,这样在排版时才有更多选择。如果是一个平面设计师,为了达到较好的设计效果,需要安装的字体就更多,几十种、上百种各式各样的中文字体、英文字体都会装上。字库的体积有时会达到惊人的10G,不但占用了硬盘空…

truetype字体怎么转换成普通字体_win10肿么安装truetype字体

Win 10 、Win 8 系统的默认字体比较模糊&#xff0c;如何改为美观清晰的宋体呢&#xff0c;修改注册表就可以做到&#xff0c;方法如下&#xff1a;方法/步骤Win 10 字体改为宋体方法&#xff1a;新建一个文本文档txt,将如下代码复制进去&#xff1a;Windows Registry Editor V…

计算机字体安装按钮灰色,win10系统无法安装字体安装按钮灰色的的解决方法

很多小伙伴都遇到过win10系统无法安装字体安装按钮灰色的情况&#xff0c;想必大家都遇到过win10系统无法安装字体安装按钮灰色的情况吧&#xff0c;那么应该怎么处理win10系统无法安装字体安装按钮灰色呢&#xff1f;我们依照1、首先按下Win打开运行&#xff0c;输入services.…

Win10如何用cmd或者Powershell批量安装字体

情况说明&#xff1a; 网上常见的2种方法都试了&#xff0c;全部失败&#xff1a;1. bat直接把字体们copy到系统Font文件夹&#xff0c;管理员运行&#xff0c;输出显示全部复制成功&#xff0c;但其实系统Font文件夹点开查看一个字体都没装进去。2. 失败后怀疑是不是没注册的…

win10安装字体

win10安装字体 字体文件以ttf结尾&#xff0c;复制需要安装的字体。打开c盘找到Windows文件夹双击 找到Fonts双击进入 把复制的字体粘贴到这个页面