3

我有 2 个英特尔 realsense 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")
4

1 回答 1

0

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

config = re.config()
config.enable_device('805212060066')
profile = config.resolve(pipeline)
于 2020-04-15T20:30:44.487 回答