首页 > 编程语言 >使用Open3D进行PCD拟合平面的Python代码示例

使用Open3D进行PCD拟合平面的Python代码示例

时间:2023-05-11 20:55:08浏览次数:42  
标签:示例 Python 0.0 vertices plane geometry Open3D o3d pcd

使用Open3D进行PCD拟合平面的Python代码示例

 

import open3d as o3d  
import numpy as np  
  
# 读取点云数据  
pcd = o3d.io.read_point_cloud("2023042501.pcd")  
  
# 创建PCD图  
pcd_graph = o3d.geometry.PointCloudGraph(pcd)  
  
# 选择要拟合的平面  
plane_center = o3d.geometry.Vector3d(0.0, 0.0, 0.0)  
plane_normal = o3d.geometry.Vector3d(1.0, 0.0, 0.0)  
plane_vertices = o3d.geometry.Vector3d(0.0, 0.0, 0.0)  
  
# 创建平面  
plane = o3d.geometry.Plane(plane_center, plane_normal)  
  
# 添加点云数据到平面  
plane_vertices = o3d.geometry.Vector3d(pcd.vertices[0], pcd.vertices[1], pcd.vertices[2])  
o3d.geometry.centroid(plane)  
plane.set_vertex_data_multi(plane_vertices)  
  
plane_vertices = o3d.geometry.Vector3d(pcd.vertices[0], pcd.vertices[1], pcd.vertices[2])  
o3d.geometry.center(plane)  
plane.set_vertex_data_multi(plane_vertices)  
  
plane_vertices = o3d.geometry.Vector3d(pcd.vertices[0], pcd.vertices[1], pcd.vertices[2])  
o3d.geometry.normal(plane)  
plane.set_vertex_data_multi(plane_vertices)  
  
# 显示结果  
o3d.visualization.draw_geometries([pcd_graph, plane])  
  
# 输出平面参数  
print("平面参数:", plane_center, plane_normal, plane_vertices)

 

 

 

#####################

标签:示例,Python,0.0,vertices,plane,geometry,Open3D,o3d,pcd
From: https://www.cnblogs.com/herd/p/17353199.html

相关文章

  • Python协程asyncio
    在Python使用multiprocessing进行多线程和多进程操作 这篇文章中介绍了使用多线程的方式对一些I/O操作(文件读写、网络请求,这些操作不用等待其结束,在此期间可以做其他事情)进行加速。而本篇文章介绍的协程可以理解成“微线程”,不开辟其他线程,只在一个线程中执行,并且执行函数时......
  • Python OOP & Class private method All In One
    PythonOOP&ClassprivatemethodAllInOnePythonClassprivatemethoddemos代码缩进错误调用私有方法错误#!/usr/bin/python3#类定义classpeople:#定义基本属性name=''age=0#定义私有属性,私有属性在类外部无法直接进行访问_......
  • Python range function All In One
    PythonrangefunctionAllInOnerange函数函数语法range(stop)range(start,stop[,step])参数说明:start:计数从start开始。默认是从0开始。例如range(5)等价于range(0,5)stop:计数到stop结束,但不包括stop。例如:range(0,5)是[0,1,2,3,4]没有......
  • Python的基础核心知识
    编程语言和编程编程语言语言:人与人之间沟通的媒介编程语言:人与计算机沟通的语言编程程序员通过计算机能够读懂的语言把自己的思想和逻辑写下来的过程编程的初衷是更好的奴隶计算机计算机五大组成部分部1.控制器2.运算器3.存储器4.输出设备5.输入设备计算机三大核心硬......
  • 初学计算机python
    今天正式开始学习计算机python,从最基础的概念开始。学习计算机需要使用一款编辑软件辅助学习,Typora是个很好的选择。初学Typora目前只对一些基本快捷键做了解,做前期准备。对六种标题快捷键,几个#就是几级标题,或者直接Ctrl+1、2、3、4、5、6转变相应等级标题。另外还有无序标题:“......
  • python异步正则字符串替换,asyncio异步正则字符串替换re
     自然语言处理经常使用re正则模块进行字符串替换,但是文本数量特别大的时候,需要跑很久,这就需要使用asyncio异步加速处理importpandasaspdimportreimportasynciodata=pd.read_csv("guba_all_post_20230413.csv")data.dropna(inplace=True)#defreplace_betwee......
  • python异步字符串查找,asyncio和marisa_trie
     自然语言处理当中经常需要字符串的查找操作,比如通过查找返回字串在文本当中的位置,比如通过匹配实现的nerimportpandasaspdimportasyncio#data=pd.read_csv("guba_fc_result_20230413.csv")data=pd.read_csv("guba_all_post_20230413.csv")filename="cate_gr......
  • R语言中调用调用python
       ......
  • python3.11 支持TA-lib
    网上找了很多地方才找到的,以下是原网面内容分享给大家:原网址python3.11支持TA-lib-简书(jianshu.com) python3.11支持TA-libasmcos关注IP属地:北京2022.11.0316:42:52字数122阅读1,075做量化的朋友都知道Ta-lib的windows库相当难编译。python3.11性能提升......
  • python 下载整个网页到本地(保持原有链接)样式
    pipinstallpagesnapplaywrightinstallpython310以上命令:pagesnap网址 网络名称提示:请求成功response.url='https://www.cnpython.com/pypi/singlefile'请求成功response.url='https://www.cnpython.com/media/pypi/static/css/brands.0c9eb08b.css'资源类型为css请求......