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??
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);