IntelRealSense / realsense-ros

ROS Wrapper for Intel(R) RealSense(TM) Cameras
http://wiki.ros.org/RealSense
Apache License 2.0
2.51k stars 1.74k forks source link

How to publish infra1 as rgb? #472

Closed marnix93 closed 5 years ago

marnix93 commented 5 years ago

Hi, Recently, I discovered that the IR cameras of the D415 are actually rgb sensors. In the realsense viewer I can visualize the left infrared stream as an rgb image. I would like to do the same in the ROS wrapper. Therefore I changed the lines 33-39 in the base_realsense_node.cpp to the following: // Infrared stream - Left _is_frame_arrived[INFRA1] = false; _format[INFRA1] = RS2_FORMAT_RGB8; // libRS type _image_format[INFRA1] = CV_8UC3; // CVBridge type _encoding[INFRA1] = sensor_msgs::image_encodings::RGB8; // ROS message type _unit_step_size[INFRA1] = 3; // sensor_msgs::ImagePtr row step size _stream_name[INFRA1] = "infra1"; _depth_aligned_encoding[INFRA1] = sensor_msgs::image_encodings::TYPE_16UC1;

However, I get the following warning at runtime: "Given stream configuration is not supported by the device! Stream: Infrared, Stream Index: 1, Format: RGB8, Width: 1280, Height: 720, FPS: 15".

I think it has to do with the stream index. If I run rs-enumerate-devices I see the following (snapshot):

Infrared 2    1280x720  @ 30Hz  Y8
Infrared 1    1280x720  @ 30Hz  Y8
Infrared      1280x720  @ 30Hz  BGRA8
Infrared      1280x720  @ 30Hz  RGBA8

Other formats than Y8 seem to be possible, but the index is missing there. I cannot figure out how to get this working, maybe I'm missing something. Can someone help me?

RealSenseCustomerSupport commented 5 years ago

[Please Ignore - RealSense system comment]

RealSenseCustomerSupport commented 5 years ago

Close this issue for lack of activity. Please feel free to reopen if the issue is still relevant.