当前位置: 首页 > news >正文

open3d io操作

目录

1. read_image, write_image

2. read_point_cloud, write_point_cloud

3. 深度相机IO操作

4. Mesh文件读取


1. read_image, write_image

读取jpg. png. bmp等文件

image_io.py

import open3d as o3dif __name__ == "__main__":img_data = o3d.data.JuneauImage()print(f"Reading image from file: Juneau.jpg stored at {img_data.path}")# 1. readimg = o3d.io.read_image(img_data.path)  # JuneauImage.jpgprint(img)  # open3d.geometry.Image. Image of size 800x489, with 3 channels.print("Saving image to file: copy_of_Juneau.jpg")# 2. writeo3d.io.write_image("copy_of_Juneau.jpg", img)  # open3d.geometry.Image

2. read_point_cloud, write_point_cloud

读写点云pcd, ply等文件

point_cloud_io.py

import open3d as o3dif __name__ == "__main__":pcd_data = o3d.data.PCDPointCloud()print(f"Reading pointcloud from file: fragment.pcd stored at {pcd_data.path}")# 1. read PointCloud.pcdpcd = o3d.io.read_point_cloud(pcd_data.path)  print(pcd)print("Saving pointcloud to file: copy_of_fragment.pcd")# 2. write PointCloudo3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)

3. 深度相机IO操作

读取深度相机

realsense_io.py 

"""Demonstrate RealSense camera discovery and frame capture"""import open3d as o3dif __name__ == "__main__":o3d.t.io.RealSenseSensor.list_devices()rscam = o3d.t.io.RealSenseSensor()  # 深度相机,比如D435irscam.start_capture()print(rscam.get_metadata())for fid in range(5):rgbd_frame = rscam.capture_frame()o3d.io.write_image(f"color{fid:05d}.jpg", rgbd_frame.color.to_legacy())  # 彩色图像. tensor转o3d.io.write_image(f"depth{fid:05d}.png", rgbd_frame.depth.to_legacy())  # 深度图像print("Frame: {}, time: {}s".format(fid, rscam.get_timestamp() * 1e-6))rscam.stop_capture()

4. Mesh文件读取

读取mesh网格数据,ply等文件

triangle_mesh_io.py

import open3d as o3dif __name__ == "__main__":knot_data = o3d.data.KnotMesh()print(f"Reading mesh from file: knot.ply stored at {knot_data.path}")mesh = o3d.io.read_triangle_mesh(knot_data.path)  # TriangleMeshprint(mesh)print("Saving mesh to file: copy_of_knot.ply")o3d.io.write_triangle_mesh("copy_of_knot.ply", mesh)

http://www.lryc.cn/news/66273.html

相关文章:

  • 【Linux】Linux安装Redis(图文解说详细版)
  • setTimeout不准时,CSS精准实现计时器功能
  • 单细胞跨模态分析综述
  • 【零基础学机器学习 1】什么是机器学习?
  • ARM处理器与中断——嵌入式(驱动)软开基础(一)
  • WX小程序 - 2
  • 开源之夏2023 | 欢迎申请openEuler Embedded SIG开发任务
  • 【异常解决】vim编辑文件时提示 Found a swap file by the name “.start.sh.swp“的解决方案
  • 「企业应用架构」应用架构概述
  • ePWM模块(3)
  • 【笔试强训选择题】Day11.习题(错题)解析
  • JVM知识
  • 操作系统第二章——进程与线程(中)
  • AlphaFold的极限:高中生揭示人工智能在生物信息学挑战中的缺陷
  • RocketMQ双主双从环境搭建
  • next.js博客搭建_初始化next项目(第一步)
  • ACM - 其他算法 - 基础(前缀和 + 差分)
  • No.056<软考>《(高项)备考大全》【冲刺10】《软考高项常见工具口语化解释》
  • MySQL原理(九):表分区和分库分表
  • 【Ehcache技术专题】「入门到精通」带你一起从零基础进行分析和开发Ehcache框架的实战指南(缓存查询-配置篇)
  • MySQL基础(七)单行函数
  • Cy5.5-PEG-FA结构式 荧光Cy5.5标记聚乙二醇叶酸;PEG分子量2000,叶酸(-FA)基团可应用于靶向传递
  • 【微服务笔记23】使用Spring Cloud微服务组件从0到1搭建一个微服务工程
  • 舞台特效-第14届蓝桥杯省赛Scratch初级组真题第2题
  • mysql 5.7.32安装及主从安装信息
  • leecode111——二叉树最短路径
  • Swift学习教程大纲
  • HTML 基础知识
  • 国考省考结构化面试:综合分析题,名言哲理(警句观点启示)、漫画反驳题等
  • 【前端面经】CSS-浮动和清除浮动的方式