CameraOne.retrieveImage how to return bgr8

Hello, I’m using ZED X One camera with the ROS 2 wrapper (SDK5.1.1, master branch, no nitros) and I noticed that the raw images are published with encoding: bgra8.

Tracking down the image pipeline it seems to me that CameraOne.retrieveImage only returns rgb images in bgra8.

Is there a reason for CameraOne.retrieveImage to return bgra instead of bgr? The alpha channel is full of 255, so it just makes each ROS 2 image message 33% larger.

Hi @beniaminopozzan

This is a setting of the SDK that was introduced a long time ago for performance improvement while handling data on GPU memory.

Today, 32-bit BGRA is the default setting for backward compatibility, but we recently introduced methods to also retrieve 24-bit BGR images.
You must use retrieveImage with sl::VIEW::LEFT_BGR, instead of sl::VIEW::LEFT:

A new parameter will be added soon to the ZED ROS2 Wrapper to select between 24-bit and 32-bit image types.

Thanks @Myzhar !
I did not notice there were so many options of sl::VIEW

1 Like

It is advisable to review the API documentation periodically, as occasionally not all new features are fully reflected in the changelog :wink: