Items with no label
Annonces
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
3340 Discussions

How can the depth image be streamed directly as uint8 image instead of uint16?

SSant15
Débutant
3 954 Visites

Hi everyone. I am using the Intel® RealSense™ Depth Camera D435 together with python and openCV. My goal is to convert the depth image from uint16 to uint8. At the moment I take in the image with enable_stream and set the format to: rs.format.z16. Is there a way to directly set the format to uint8 in the enable_stream function? Alternatively I tried to:

a) convert the function in opencv with astype (not recommended for images)

b) with convertTo from this intel forum

c) with img_as_ubyte from the module skimage

As I am struggling with delays, I want to ensure I'm doing the conversion in the most efficient way. Furthermore option b) and c) both distort the original image.

Thank you very much for any help!

0 Compliments
2 Réponses
MartyG
Contributeur émérite III
2 951 Visites

The RealSense 400 Series cameras only support 16-bit depth (Z16). Traditionally, the most popularly used ways to get an 8-bit image have been to convert the RealSense 16-bit stream to 8-bit data using OpenCV or MATLAB.

 

RealSense SDK 2.0 has a MATLAB wrapper to interface the SDK with MATLAB.

 

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/matlab

 

Intel have created a sample program for the wrapper to capture and render the depth frame with a live device.

 

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/matlab/depth_example.m

 

Alternatively, a MATLAB product that may provide more comprehensive control of live camera data than the SDK 2.0 wrapper currently can may be the Image Processing Toolbox.

 

https://uk.mathworks.com/products/image.html

0 Compliments
SSant15
Débutant
2 951 Visites

Thank you very much for your reply! I am working with OpenCV. Do you know by any chance about a project working with OpenCV and transforming the image to uint8 without the function astype()?

0 Compliments
Répondre