Items with no label
3335 Discussions

Select Camera by S/N - Python3.5 and Pyrealsense2

MTont
Beginner
3,245 Views

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 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)  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....

0 Kudos
3 Replies
MTont
Beginner
1,829 Views

Ok I found a solution that I missed in one of the examples

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")

0 Kudos
MartyG
Honored Contributor III
1,829 Views

Great news that you found a solution! I had a look too but you beat me to it

0 Kudos
MTont
Beginner
1,829 Views

Here there are more info and a solution: https://github.com/IntelRealSense/librealsense/issues/1735 Connecting multiple devices with pyrealsense2 · Issue # 1735 · IntelRealSense/librealsense · GitHub

0 Kudos
Reply