robokudo.utils.type_conversion¶
Type conversion utilities for Robokudo.
This module provides functions for converting between different type representations:
ROS message types to Python dictionaries
Robokudo annotations to ROS geometry messages
Pose and position annotations to transform matrices
The module supports bidirectional conversion between: * ROS CameraInfo messages * Geometry messages (Pose, PoseStamped) * Robokudo annotation types * Transform matrices
Functions¶
|
Convert ROS CameraInfo message to dictionary. |
|
Convert dictionary to ROS CameraInfo message. |
Convert position annotation to ROS Pose message. |
|
Convert pose annotation to ROS Pose message. |
|
Convert pose annotation to ROS PoseStamped message. |
|
|
Convert position annotation to ROS PoseStamped message. |
Convert pose annotation to 4x4 transform matrix. |
|
Convert a bounding box annotation to an open3d oriented bounding box. |
|
Convert ROS CameraInfo to Open3D camera intrinsics. |
|
|
Convert ROS image message to OpenCV image. |
|
Convert OpenCV image to ROS image message. |
Module Contents¶
- robokudo.utils.type_conversion.ros_cam_info_to_dict(cam_info: sensor_msgs.msg.CameraInfo) typing_extensions.Dict¶
-
Convert ROS CameraInfo message to dictionary.
- Parameters:
-
cam_info – ROS CameraInfo message
- Returns:
-
Dictionary representation of camera info
- robokudo.utils.type_conversion.ros_cam_info_from_dict(dict_cam_info: typing_extensions.Dict) sensor_msgs.msg.CameraInfo¶
-
Convert dictionary to ROS CameraInfo message.
- Parameters:
-
dict_cam_info – Dictionary containing camera info
- Returns:
-
ROS CameraInfo message
- robokudo.utils.type_conversion.get_geometry_msgs_pose_from_position_annotation(position_annotation: robokudo.types.annotation.PositionAnnotation) geometry_msgs.msg.Pose¶
-
Convert position annotation to ROS Pose message.
Creates a Pose with position from annotation and identity quaternion.
- Parameters:
-
position_annotation – Position annotation to convert
- Returns:
-
ROS Pose message
- robokudo.utils.type_conversion.get_geometry_msgs_pose_from_pose_annotation(pose_annotation: robokudo.types.annotation.PoseAnnotation) geometry_msgs.msg.Pose¶
-
Convert pose annotation to ROS Pose message.
- Parameters:
-
pose_annotation – Pose annotation to convert
- Returns:
-
ROS Pose message
- robokudo.utils.type_conversion.get_geometry_msgs_pose_stamped_from_pose_annotation(pose_annotation: robokudo.types.annotation.PoseAnnotation, header: std_msgs.msg.Header) geometry_msgs.msg.PoseStamped¶
-
Convert pose annotation to ROS PoseStamped message.
- Parameters:
-
pose_annotation – Pose annotation to convert
header – Header to use for stamped pose
- Returns:
-
ROS PoseStamped message
- robokudo.utils.type_conversion.get_geometry_msgs_pose_stamped_from_position_annotation(position_annotation: robokudo.types.annotation.PositionAnnotation, header: std_msgs.msg.Header) geometry_msgs.msg.PoseStamped¶
-
Convert position annotation to ROS PoseStamped message.
Creates a PoseStamped with position from annotation and identity quaternion.
- Parameters:
-
position_annotation – Position annotation to convert
header – Header to use for stamped pose
- Returns:
-
ROS PoseStamped message
- robokudo.utils.type_conversion.get_transform_matrix_from_pose_annotation(pose_annotation: robokudo.types.annotation.PoseAnnotation) numpy.typing.NDArray¶
-
Convert pose annotation to 4x4 transform matrix.
- Parameters:
-
pose_annotation – Pose annotation to convert
- Returns:
-
4x4 homogeneous transform matrix
- robokudo.utils.type_conversion.get_o3d_obb_from_bounding_box_annotation(bounding_box_annotation: robokudo.types.annotation.BoundingBox3DAnnotation) open3d.geometry.OrientedBoundingBox¶
-
Convert a bounding box annotation to an open3d oriented bounding box.
- Parameters:
-
bounding_box_annotation – Bounding box annotation to convert
- Returns:
-
Open3D OrientedBoundingBox representation of bounding box annotation
- robokudo.utils.type_conversion.o3d_cam_intrinsics_from_ros_cam_info(cam_info: sensor_msgs.msg.CameraInfo) open3d.camera.PinholeCameraIntrinsic¶
-
Convert ROS CameraInfo to Open3D camera intrinsics.
- Parameters:
-
cam_info – ROS camera info message
- Returns:
-
Open3D camera intrinsics
- robokudo.utils.type_conversion.convert_ros_to_cv_image(ros_image: sensor_msgs.msg.Image) numpy.typing.NDArray¶
-
Convert ROS image message to OpenCV image.
- Parameters:
-
ros_image – ROS image message
- Returns:
-
OpenCV image array
- Raises:
-
CvBridgeError – If conversion fails
- robokudo.utils.type_conversion.convert_cv_to_ros_image(cv_image: numpy.typing.NDArray) sensor_msgs.msg.Image¶
-
Convert OpenCV image to ROS image message.
- Parameters:
-
cv_image – OpenCV image array
- Returns:
-
ROS image message
- Raises:
-
CvBridgeError – If conversion fails