3

I've 2 Intel realsense D415. I'm Using a NUC with Xubuntu 16.04 and python 3.5.2. I can find only this documentation and examples: https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python

My problem is that I need to select the camera to use by serial number to be sure to select everytime the same camera.

import pyrealsense2 as rs

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

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

This code print this: < pyrealsense2.device: Intel RealSense D415 (S/N: 805212060066) >

I need to check the S/N and in case it's not the right one, I would need to pass to the second camera, then the third....

I would need a guide or a documentation about pyrealsense2 but I don't think it exists

EDIT - I found a solution:

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")
G. Threepwood
  • 454
  • 8
  • 23

1 Answers1

0

You can specify device serial number in config.

config = re.config()
config.enable_device('805212060066')
profile = config.resolve(pipeline)
Ivan Burlutskiy
  • 1,605
  • 1
  • 12
  • 22