0

I'm pretty new with OpenCV & Intel Realsense device. I can see many examples displaying only Depth video or Color video, but i really can't find any example displaying both in real-time.

I have no idea (should i multi thread?) how to make it. So anybody have any hint??

hydthemoon
  • 162
  • 1
  • 2
  • 11
  • you can show 2 different images with the imshow, just remember to change the string part (first parameter), otherwise it will be drawn in one window and the latest one wins. – api55 Aug 06 '18 at 05:18

1 Answers1

4

Here's what you need to do, in a nutshell:

a) Include required headers

#include <opencv2/dnn.hpp>
#include <librealsense2/rs.hpp>
#include "../cv-helpers.hpp" 

b) RealSense data to OpenCV Mat

auto data = pipe.wait_for_frames();
data = align_to.process(data);

auto color_frame = data.get_color_frame();
auto depth_frame = data.get_depth_frame();

auto color_mat = frame_to_mat(color_frame);
auto depth_mat = frame_to_mat(depth_frame);

c) Display color_mat and depth_mat

imshow("color",color_mat);
imshow("depth",depth_mat);
Prototype
  • 222
  • 1
  • 8