toinsson / pyrealsense

Cross-platform ctypes/Cython wrapper to the librealsense library (v1.x)
http://pyrealsense.readthedocs.io
Apache License 2.0
121 stars 46 forks source link

switch between two IR cameras #74

Closed zxh009123 closed 6 years ago

zxh009123 commented 6 years ago
Required Info
Camera Model R200
Firmware Version
Operating System & Version ubuntu 16.04 LTS
librealsense version 1.12.1
pyrealsense version 2.2

Hi, I am currently using realsense r200 on a project and I need the infrared stream. As in the realsense r200 spec, I notice that there are two IR cameras on the realsense r200. In pyrealsense, it use the right IR camera as default stream. Is there any way I can get the IR stream from the other IR camera?

toinsson commented 6 years ago

if you look at: https://github.com/toinsson/pyrealsense/blob/1b327915ee8e7a28d17c0446a720a59356fc8a40/pyrealsense/stream.py#L112 you'll notice: self.stream = rs_stream.RS_STREAM_INFRARED.

In the rs_stream structure there is also a rs_stream.RS_STREAM_INFRARED2 which should point to the second IR stream.

So define new InfraredStream2 with the correct parameter and pass it to the Device init function.

zxh009123 commented 6 years ago

Hi toinsson, Thanks for your reply. This works very well!