robokudo.utils.annotation_conversion¶
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¶
An abstract converter class for converting annotations to other annotations. |
|
An abstract converter class for converting annotations to object designators. |
|
Extended Annotation2AnnotationConverter that converts a PoseAnnotation to a StampedPoseAnnotation. |
|
Extended Annotation2AnnotationConverter that converts a Positionnnotation to a StampedPoseAnnotation. |
|
Extended Annotation2AnnotationConverter that converts a SemanticColor annotation to ObjectDesignator data. |
|
Extended Annotation2AnnotationConverter that converts a Classification annotation to ObjectDesignator data. |
|
Extended Annotation2AnnotationConverter that converts a StampedPoseAnnotation to ObjectDesignator data. |
|
Extended StampedPose2ODConverter that converts a PoseAnnotation to ObjectDesignator data. |
|
Extended Annotation2AnnotationConverter that converts a PositionAnnotation to ObjectDesignator data. |
|
Extended Annotation2AnnotationConverter that converts a StampedPositionAnnotation to ObjectDesignator data. |
|
Extended Annotation2AnnotationConverter that converts a robokudo.types.cv.BoundingBox3D to ObjectDesignator data. |
|
Extended Annotation2AnnotationConverter that converts a Shape annotation to ObjectDesignator data. |
|
Extended Shape2ODConverter that converts a Cuboid annotation to ObjectDesignator data. |
|
Extended Shape2ODConverter that converts a Sphere annotation to ObjectDesignator data. |
|
Extended Shape2ODConverter that converts a LocationAnnotation to ObjectDesignator data. |
Module Contents¶
- class robokudo.utils.annotation_conversion.Annotation2AnnotationConverter¶
-
Bases:
abc.ABCAn abstract converter class for converting annotations to other annotations.
- abstract can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: type) bool¶
-
Checks whether the converter can convert the given annotation to the given target annotation type.
- Parameters:
-
annotation – The annotation to check for conversion.
target_annotation_type – The target annotation type to convert annotation to.
- Returns:
-
Whether the converter can convert annotation to target_annotation_type.
- abstract convert(annotation: robokudo.types.core.Annotation, cas: robokudo.cas.CAS = None) robokudo.types.core.Annotation¶
-
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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
- Returns:
-
The converted annotation.
- class robokudo.utils.annotation_conversion.Annotation2ODConverter¶
-
Bases:
abc.ABCAn abstract converter class for converting annotations to object designators.
- abstract can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- abstract convert(annotation: robokudo.types.core.Annotation, 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.PoseAnnotationToStampedPoseAnnotationConverter¶
-
Bases:
Annotation2AnnotationConverterExtended Annotation2AnnotationConverter that converts a PoseAnnotation to a StampedPoseAnnotation.
- 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.
- Parameters:
-
annotation – The annotation to check for conversion.
target_annotation_type – The target annotation type to convert annotation to.
- Returns:
-
Whether the converter can convert annotation to target_annotation_type.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
- Returns:
-
The converted annotation.
- class robokudo.utils.annotation_conversion.PositionAnnotationToStampedPoseAnnotationConverter¶
-
Bases:
Annotation2AnnotationConverterExtended Annotation2AnnotationConverter that converts a Positionnnotation to a StampedPoseAnnotation.
- 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.
- Parameters:
-
annotation – The annotation to check for conversion.
target_annotation_type – The target annotation type to convert annotation to.
- Returns:
-
Whether the converter can convert annotation to target_annotation_type.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
- Returns:
-
The converted annotation.
- class robokudo.utils.annotation_conversion.SemanticColor2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a SemanticColor annotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Classification2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a Classification annotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.StampedPose2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a StampedPoseAnnotation to ObjectDesignator data.
- can_convert(annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Pose2ODConverter¶
-
Bases:
StampedPose2ODConverterExtended StampedPose2ODConverter that converts a PoseAnnotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Position2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a PositionAnnotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.StampedPosition2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a StampedPositionAnnotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.BoundingBox3DForShapeSizeConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a robokudo.types.cv.BoundingBox3D to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Shape2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Annotation2AnnotationConverter that converts a Shape annotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Cuboid2ODConverter¶
-
Bases:
Shape2ODConverterExtended Shape2ODConverter that converts a Cuboid annotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Sphere2ODConverter¶
-
Bases:
Shape2ODConverterExtended Shape2ODConverter that converts a Sphere annotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation
- class robokudo.utils.annotation_conversion.Location2ODConverter¶
-
Bases:
Annotation2ODConverterExtended Shape2ODConverter that converts a LocationAnnotation to ObjectDesignator data.
- can_convert(annotation: robokudo.types.core.Annotation) bool¶
-
Checks whether the converter can convert the given annotation to an object designator.
- Parameters:
-
annotation – The annotation to check for conversion.
- Returns:
-
Whether the converter can convert annotation to ObjectDesignator.
- 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.
- Parameters:
-
annotation – The annotation to convert.
cas – The CAS to use for conversion.
object_designator – The object designator to fill with the data of annotation