来自:https://github.com/IntelRealSense/librealsense/issues/1231
------------------------------
import pyrealsense2 as rs
pipeline = rs.pipeline()
pipe_profile = pipeline.start()
frames = pipeline.wait_for_frames()
depth_frame = frames.get_depth_frame()
color_frame = frames.get_color_frame() # Intrinsics & Extrinsics
depth_intrin = depth_frame.profile.as_video_stream_profile().intrinsics
color_intrin = color_frame.profile.as_video_stream_profile().intrinsics
depth_to_color_extrin = depth_frame.profile.get_extrinsics_to(color_frame.profile) # Depth scale - units of the values inside a depth frame, i.e how to convert the value to units of 1 meter
depth_sensor = pipe_profile.get_device().first_depth_sensor()
depth_scale = depth_sensor.get_depth_scale() # Map depth to color
depth_pixel = [240, 320] # Random pixel
depth_point = rs.rs2_deproject_pixel_to_point(depth_intrin, depth_pixel, depth_scale)
color_point = rs.rs2_transform_point_to_point(depth_to_color_extrin, depth_point)
color_pixel = rs.rs2_project_point_to_pixel(color_intrin, color_point)
pipeline.stop()

-----------------------------

pc = rs.pointcloud()
frames = pipeline.wait_for_frames()
depth = frames.get_depth_frame()
color = frames.get_color_frame()
img_color = np.asanyarray(color.get_data())
img_depth = np.asanyarray(depth.get_data())
pc.map_to(color)
points = pc.calculate(depth)
vtx = np.asanyarray(points.get_vertices())
tex = np.asanyarray(points.get_texture_coordinates()) npy_vtx = np.zeros((len(vtx), 3), float)
for i in range(len(vtx)):
npy_vtx[i][0] = np.float(vtx[i][0])
npy_vtx[i][1] = np.float(vtx[i][1])
npy_vtx[i][2] = np.float(vtx[i][2]) npy_tex = np.zeros((len(tex), 3), float)
for i in range(len(tex)):
npy_tex[i][0] = np.float(tex[i][0])
npy_tex[i][1] = np.float(tex[i][1])

												

Realsense D430 python pointclound的更多相关文章

  1. Realsense D430 save

    rs-save-to-disk.cpp // License: Apache 2.0. See LICENSE file in root directory. // Copyright(c) 2015 ...

  2. Intel realSense ubuntu 16.04+python 环境配置指南

    1. 安装librealsense2-dkms 以及librealsense2-utils 1.Register the server's public key: sudo apt-key adv - ...

  3. realsense and Mask_RCNN

    ###################librealsense and Mask_RCNN cd RealSennse/librealsense2018091501/librealsense/wrap ...

  4. Python中的多进程与多线程(一)

    一.背景 最近在Azkaban的测试工作中,需要在测试环境下模拟线上的调度场景进行稳定性测试.故而重操python旧业,通过python编写脚本来构造类似线上的调度场景.在脚本编写过程中,碰到这样一个 ...

  5. Python高手之路【六】python基础之字符串格式化

    Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存.[PEP-3101] This ...

  6. Python 小而美的函数

    python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况   any any(iterable) ...

  7. JavaScript之父Brendan Eich,Clojure 创建者Rich Hickey,Python创建者Van Rossum等编程大牛对程序员的职业建议

    软件开发是现时很火的职业.据美国劳动局发布的一项统计数据显示,从2014年至2024年,美国就业市场对开发人员的需求量将增长17%,而这个增长率比起所有职业的平均需求量高出了7%.很多人年轻人会选择编 ...

  8. 可爱的豆子——使用Beans思想让Python代码更易维护

    title: 可爱的豆子--使用Beans思想让Python代码更易维护 toc: false comments: true date: 2016-06-19 21:43:33 tags: [Pyth ...

  9. 使用Python保存屏幕截图(不使用PIL)

    起因 在极客学院讲授<使用Python编写远程控制程序>的课程中,涉及到查看被控制电脑屏幕截图的功能. 如果使用PIL,这个需求只需要三行代码: from PIL import Image ...

随机推荐

  1. 转 OpenFaaS 介绍

    来源: https://thenewstack.io/openfaas-put-serverless-function-container/?utm_source=tuicool&utm_me ...

  2. openfaas 简单试用

    1. 安装 faas-cli  参考以前文章,或者使用官方的shell脚本   2. 简单例子 mkdir rong cd rong faas-cli new rong --lang python / ...

  3. fn project 对象模型

    Applications At the root of everything are applications. In fn, an application is essentially a grou ...

  4. Linux环境下安装jenkins

    废话不多说,直接开始 1.从官网下载Jenkins的war包 2.下载好的War放到Tomcat的网站根目录webapps下,然后启动Tomcat. 3.打开浏览器,输入http://IP:8080/ ...

  5. .com .cn .org .edu等域名的意义

    在开发的时候遇到了.org的域名,后来就去查了一下,原来这种域名是非盈利组织或者协会的标志 比如: https://getcomposer.org/ https://packagist.org/ ht ...

  6. Linux_LVM Couldn't find device with uuid

    Linux LVM commands result in Couldn't find device with uuid Couldn't find all physical volumes for v ...

  7. mysql函数之一:INSTR、LOCATE、POSITION VS LIKE

    LOCATE.POSITION和INSTR函数相似功能实例 使用LOCATE.POSITION和INSTR函数查找字符串中指定子字符串的开始位置.SQL语句如下: mysql>SELECT LO ...

  8. Build Assetbundle出错:An asset is marked as dont save, but is included in the build

    前天Build Assetbundle的时候出错了,导致打包失败,具体日志内容如下: An asset is marked as dont save, but is included in the b ...

  9. log4net 使用总结- (1)在ASP.NET MVC 中使用

    1. 去官网下载log4net.dll,增加引用到站点下(你也可以通过nuget 安装) http://logging.apache.org/log4net/download_log4net.cgi ...

  10. IDA Pro 权威指南学习笔记(一) - 启动 IDA

    启动 IDA 启动 IDA,有一个欢迎界面 之后有一个对话框 选择 New 将启动一个对话框来选择将要分析的文件 选择 Go 将使 IDA 打开一个空白的工作区 如果要选择分析的文件,可以直接拖到 I ...