python - Pyrealsense2 (Librealsense SDK 2.0) : choose cam from Serial Number

标签 python python-3.x usb realsense

我有 2 个英特尔实感 D415。我正在使用带有 Xubuntu 16.04 和 python 3.5.2 的 NUC。 我只能找到此文档和示例:https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python

我的问题是我需要通过序列号选择要使用的相机,以确保每次都选择相同的相机。

import pyrealsense2 as rs

pipeline = rs.pipeline()
config = rs.config()
profile = config.resolve(pipeline)

profile = config.resolve(pipeline)
print(profile.get_device())

此代码打印:< pyrealsense2.device: Intel RealSense D415 (S/N: 805212060066) >

我需要检查 S/N,以防它不正确,我需要传递给第二台相机,然后是第三台....

我需要有关 pyrealsense2 的指南或文档,但我认为它不存在

编辑 - 我找到了解决方案:

import pyrealsense2 as rs

ctx = rs.context()
if len(ctx.devices) > 0:

for d in ctx.devices:

    print ('Found device: ', \

            d.get_info(rs.camera_info.name), ' ', \

            d.get_info(rs.camera_info.serial_number))

else:

    print("No Intel Device connected")

最佳答案

您可以在配置中指定设备序列号。

config = re.config()
config.enable_device('805212060066')
profile = config.resolve(pipeline)

关于python - Pyrealsense2 (Librealsense SDK 2.0) : choose cam from Serial Number,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50724909/

相关文章:

python - 删除 Pandas 中的评论行

python - 使用 GPU 的数组操作输出错误

python - 检测 GUI 中的特定按键

python - 使用 Instagram API 获取 Instagram 中用户的关注者数量

linux - USB 上的可移植 GCC

macos - TrendNet TU-S9 RS232/USB 和 OS X

windows - Windows 下优盘和优盘的区别

python-3.x - Telethon 异步类型提示

python - Python 3.x 中新的 print 函数相对于 Python 2 的 print 语句有什么优势?

python - 使用python计算输入的位数