robokudo.utils.cv_bridge_workaround

A lightweight replacement for cv_bridge while NumPy 2 is in use.

This class exists because the currently available cv_bridge binary can be compiled against NumPy 1.x and fails to import in environments that use NumPy 2. When cv_bridge wheels/packages become available that are compiled against NumPy 2, this module should be removed and users should switch back to cv_bridge.CvBridge.

Only a subset of the original interface is implemented here: * imgmsg_to_cv2 * cv2_to_imgmsg

The implementation intentionally focuses on encodings used by RoboKudo camera pipelines and type conversion helpers.

Classes

CVBridgeWorkaround

Subset replacement for cv_bridge.CvBridge.

Module Contents

class robokudo.utils.cv_bridge_workaround.CVBridgeWorkaround

Subset replacement for cv_bridge.CvBridge.

The API is intentionally close to cv_bridge for drop-in usage in existing code paths.

_GENERIC_ENCODING_RE
_ENCODING_TO_DTYPE_CHANNELS
imgmsg_to_cv2(img_msg: sensor_msgs.msg.Image, desired_encoding: str = 'passthrough') numpy.typing.NDArray

Convert ROS sensor_msgs/Image to a NumPy/OpenCV image.

cv2_to_imgmsg(cv_image: numpy.typing.NDArray, encoding: str = 'passthrough') sensor_msgs.msg.Image

Convert a NumPy/OpenCV image to ROS sensor_msgs/Image.

classmethod _encoding_to_dtype_channels(encoding: str) typing_extensions.Tuple[numpy.dtype, int]
classmethod _decode_image_message(msg: sensor_msgs.msg.Image) numpy.typing.NDArray
classmethod _infer_ros_encoding_from_cv_image(cv_image: numpy.typing.NDArray) str