Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get the left and the right infrared streams from D435 with Paython #3885

Closed
PhilACN opened this issue May 2, 2019 · 7 comments
Closed

Comments

@PhilACN
Copy link

PhilACN commented May 2, 2019

The color and depth is working fine.
Even when i only want 1 input of infrared.

But when the output / video is running -> only the right IR channel is used.

how do i get both?
And the depth map is working over both left and right ...

@PhilACN
Copy link
Author

PhilACN commented May 2, 2019

i tried this one .. but that doesnt work!
config.enable_stream(rs.stream.infrared, 1, 640, 480, rs.format.y8, 6)
config.enable_stream(rs.stream.infrared, 2, 640, 480, rs.format.y8, 6)

The Error says: Runtime Error: Couldnt resolve requests

@dorodnic
Copy link
Contributor

dorodnic commented May 2, 2019

Perhaps the camera is not in advanced mode?
Please open the Viewer and select one of the presets. If a popup will appear, say yes, the camera will restart and enable Infrared2 formats.

@PhilippPoeschke
Copy link

is there a opportunity to change that in the code? i mean activate the advanced mode and activate the second infrared stream?

@realsens01
Copy link

This seems related to my issue #3878

@PhilACN
Copy link
Author

PhilACN commented May 3, 2019

i dont know why it is working now but this one is working fine for me:

pipeline = rs.pipeline()

config = rs.config()
config.enable_stream(rs.stream.infrared, 1, 640, 480, rs.format.y8, 30)
config.enable_stream(rs.stream.infrared, 2, 640, 480, rs.format.y8, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)

colorizer = rs.colorizer()
pipeline.start(config)

profile = pipeline.get_active_profile()
infrared_profile = rs.video_stream_profile(profile.get_stream(rs.stream.infrared, 2))
infrared_intrinsics = infrared_profile.get_intrinsics()
depth_profile = rs.video_stream_profile(profile.get_stream(rs.stream.depth))
depth_intrinsics = depth_profile.get_intrinsics()

print(infrared_profile)
print(infrared_intrinsics)
print(depth_profile)
print(depth_intrinsics)

while True:

    frames = pipeline.wait_for_frames()

    infrared_frame_zero = frames.get_infrared_frame(1)
    infrared_frame_one  = frames.get_infrared_frame(2)
    depth_frame = frames.get_depth_frame()
    color_frame = frames.get_color_frame()

    infrared_colormap_zero = np.asanyarray(colorizer.colorize(infrared_frame_zero).get_data())
    infrared_colormap_one = np.asanyarray(colorizer.colorize(infrared_frame_one).get_data())
    depth_colormap = np.asanyarray(colorizer.colorize(depth_frame).get_data())
    colormap = np.asanyarray(colorizer.colorize(color_frame).get_data())

    images = np.hstack((depth_colormap, colormap))

    cv2.imshow('RealSense', images)

    if cv2.waitKey(25) == ord('q'):
        break
pipeline.stop()
cv2.destroyAllWindows()

@RealSenseCustomerSupport
Copy link
Collaborator


Hi PhilippRay,

Thanks for the update. Close this one.

@realsens01
Copy link

realsens01 commented May 14, 2019

@RealSenseCustomerSupport: PhilippRay's code does not work for me. Same problem.

@dorodnic : As I mention in #3878, advanced mode is enabled in my case, and both IR streams can be recorded via Realsense Viewer, but not via the Python interface.

EDIT: Including the code and output, in case it is helpful.

In [5]: %reset -f
   ...: import pyrealsense2 as rs2
   ...: pipeline = rs2.pipeline()
   ...: config = rs2.config()
   ...: config.enable_stream(rs2.stream.infrared, 1, 640, 480, rs2.format.y8, 30)
   ...: config.enable_stream(rs2.stream.infrared, 2, 640, 480, rs2.format.y8, 30)
   ...: config.enable_stream(rs2.stream.color, 640, 480, rs2.format.bgr8, 30)
   ...: config.enable_stream(rs2.stream.depth, 640, 480, rs2.format.z16, 30)
   ...: pipeline.start(config)
   ...:
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-f256eb6d8485> in <module>()
      7 config.enable_stream(rs2.stream.color, 640, 480, rs2.format.bgr8, 30)
      8 config.enable_stream(rs2.stream.depth, 640, 480, rs2.format.z16, 30)
----> 9 pipeline.start(config)

RuntimeError: Failed to resolve request. No device found that satisfies all requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants