Items with no label
3335 Discussions

How to get depth raw data and into OPENCV matrix

fHsu9
Beginner
1,418 Views

Hi,

I'm using a D435 camera. Is there a way to get the raw data (16-bit depth value) into OPENCV Mat?

Thanks!

0 Kudos
1 Reply
MartyG
Honored Contributor III
367 Views

There is a sample program for creating a .mat file from a colorized stream.

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv/imshow librealsense/wrappers/opencv/imshow at master · IntelRealSense/librealsense · GitHub

In this line mentioned in the article:

Mat image(Size(w, h), CV_8UC3, (void*)depth.get_data(), Mat::AUTO_STEP);

I think that if you wanted a non-colorized 8-bit stream, you would probably change the CV_8UC3 (an 8-bit colorized stream with 3 channels) to CV_16U

0 Kudos
Reply