robokudo.utils.annotation_conversion ==================================== .. py:module:: robokudo.utils.annotation_conversion .. autoapi-nested-parse:: This module provides conversion methods from Annotations to other types, such as ROS Message types. It's mainly used to in the result generation to fill the query result from the available annotations, hence it requires a target ObjectDesignator to act on. Classes ------- .. autoapisummary:: robokudo.utils.annotation_conversion.Annotation2AnnotationConverter robokudo.utils.annotation_conversion.Annotation2ODConverter robokudo.utils.annotation_conversion.PoseAnnotationToStampedPoseAnnotationConverter robokudo.utils.annotation_conversion.PositionAnnotationToStampedPoseAnnotationConverter robokudo.utils.annotation_conversion.SemanticColor2ODConverter robokudo.utils.annotation_conversion.Classification2ODConverter robokudo.utils.annotation_conversion.StampedPose2ODConverter robokudo.utils.annotation_conversion.Pose2ODConverter robokudo.utils.annotation_conversion.Position2ODConverter robokudo.utils.annotation_conversion.StampedPosition2ODConverter robokudo.utils.annotation_conversion.BoundingBox3DForShapeSizeConverter robokudo.utils.annotation_conversion.Shape2ODConverter robokudo.utils.annotation_conversion.Cuboid2ODConverter robokudo.utils.annotation_conversion.Sphere2ODConverter robokudo.utils.annotation_conversion.Location2ODConverter Module Contents --------------- .. py:class:: Annotation2AnnotationConverter Bases: :py:obj:`abc.ABC` An abstract converter class for converting annotations to other annotations. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: type) -> bool :abstractmethod: Checks whether the converter can convert the given annotation to the given target annotation type. :param annotation: The annotation to check for conversion. :param target_annotation_type: The target annotation type to convert `annotation` to. :returns: Whether the converter can convert `annotation` to `target_annotation_type`. .. py:method:: convert(annotation: robokudo.types.core.Annotation, cas: robokudo.cas.CAS = None) -> robokudo.types.core.Annotation :abstractmethod: Converts the given annotation to the given target annotation type. Use `self.can_convert` to check whether the converter is able to convert the given annotation to the desired type. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :returns: The converted annotation. .. py:class:: Annotation2ODConverter Bases: :py:obj:`abc.ABC` An abstract converter class for converting annotations to object designators. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool :abstractmethod: Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.core.Annotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None :abstractmethod: Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: PoseAnnotationToStampedPoseAnnotationConverter Bases: :py:obj:`Annotation2AnnotationConverter` Extended `Annotation2AnnotationConverter` that converts a `PoseAnnotation` to a `StampedPoseAnnotation`. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: typing_extensions.Type) -> bool Checks whether the converter can convert the given annotation to the given target annotation type. :param annotation: The annotation to check for conversion. :param target_annotation_type: The target annotation type to convert `annotation` to. :returns: Whether the converter can convert `annotation` to `target_annotation_type`. .. py:method:: convert(annotation: robokudo.types.annotation.PoseAnnotation, cas: robokudo.cas.CAS = None) -> robokudo.types.annotation.StampedPoseAnnotation Converts the given annotation to the given target annotation type. Use `self.can_convert` to check whether the converter is able to convert the given annotation to the desired type. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :returns: The converted annotation. .. py:class:: PositionAnnotationToStampedPoseAnnotationConverter Bases: :py:obj:`Annotation2AnnotationConverter` Extended `Annotation2AnnotationConverter` that converts a `Positionnnotation` to a `StampedPoseAnnotation`. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: typing_extensions.Type) -> bool Checks whether the converter can convert the given annotation to the given target annotation type. :param annotation: The annotation to check for conversion. :param target_annotation_type: The target annotation type to convert `annotation` to. :returns: Whether the converter can convert `annotation` to `target_annotation_type`. .. py:method:: convert(annotation: robokudo.types.annotation.PositionAnnotation, cas: robokudo.cas.CAS = None) -> robokudo.types.annotation.StampedPoseAnnotation Converts the given annotation to the given target annotation type. Use `self.can_convert` to check whether the converter is able to convert the given annotation to the desired type. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :returns: The converted annotation. .. py:class:: SemanticColor2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `SemanticColor` annotation to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.SemanticColor, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Classification2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `Classification` annotation to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.Classification, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: StampedPose2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `StampedPoseAnnotation` to `ObjectDesignator` data. .. py:method:: can_convert(annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.StampedPoseAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Pose2ODConverter Bases: :py:obj:`StampedPose2ODConverter` Extended `StampedPose2ODConverter` that converts a `PoseAnnotation` to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.PoseAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. Conversion requires a valid cam to world transform in the given CAS. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Position2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `PositionAnnotation` to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.PositionAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. Conversion requires a valid cam to world transform in the given CAS. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: StampedPosition2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `StampedPositionAnnotation` to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.StampedPositionAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. Conversion requires a valid cam to world transform in the given CAS. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: BoundingBox3DForShapeSizeConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `robokudo.types.cv.BoundingBox3D` to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.cv.BoundingBox3D, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Shape2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Annotation2AnnotationConverter` that converts a `Shape` annotation to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.Shape, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Cuboid2ODConverter Bases: :py:obj:`Shape2ODConverter` Extended `Shape2ODConverter` that converts a `Cuboid` annotation to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.Cuboid, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Sphere2ODConverter Bases: :py:obj:`Shape2ODConverter` Extended `Shape2ODConverter` that converts a `Sphere` annotation to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.Sphere, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation` .. py:class:: Location2ODConverter Bases: :py:obj:`Annotation2ODConverter` Extended `Shape2ODConverter` that converts a `LocationAnnotation` to `ObjectDesignator` data. .. py:method:: can_convert(annotation: robokudo.types.core.Annotation) -> bool Checks whether the converter can convert the given annotation to an object designator. :param annotation: The annotation to check for conversion. :returns: Whether the converter can convert `annotation` to `ObjectDesignator`. .. py:method:: convert(annotation: robokudo.types.annotation.LocationAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) -> None Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place. Use `self.can_convert` to check whether the converter is able to convert the given annotation to an object designator. :param annotation: The annotation to convert. :param cas: The CAS to use for conversion. :param object_designator: The object designator to fill with the data of `annotation`