robokudo.utils.shape_estimator_adapters

Shape-specific adapters for fitted primitive results.

Attributes

Classes

SphereFitParameters

Parameters for fitting one sphere candidate.

CylinderFitParameters

Parameters for fitting one cylinder candidate.

CuboidFitParameters

Parameters for fitting one cuboid candidate.

ShapeFitSummary

Shared compact metrics for one fitted shape candidate.

SphereFitSummary

Compact metrics for one fitted sphere candidate.

CylinderFitSummary

Compact metrics for one fitted cylinder candidate.

CuboidFitSummary

Compact metrics for one fitted cuboid candidate.

ShapeFitAdapter

Shape-specific behavior for one fitted primitive type.

SphereFitAdapter

Adapter for sphere fit results.

CylinderFitAdapter

Adapter for cylinder fit results.

CuboidFitAdapter

Adapter for cuboid fit results.

Functions

adapter_for_fit(→ ShapeFitAdapter)

Return the adapter for a fitted primitive.

rotation_matrix_from_axis(→ numpy.ndarray)

Create an orthonormal rotation matrix with z aligned to the axis.

_format_summary_value(→ str)

Format one summary value for compact log output.

_coordinate_frame(→ open3d.geometry.TriangleMesh)

Create a transformed Open3D coordinate frame.

_as_sphere_fit(→ robokudo.utils.shape_fitting.SphereFit)

_as_cylinder_fit(...)

_as_cuboid_fit(→ robokudo.utils.shape_fitting.CuboidFit)

_as_sphere_fit_parameters(→ SphereFitParameters)

_as_cylinder_fit_parameters(→ CylinderFitParameters)

_as_cuboid_fit_parameters(→ CuboidFitParameters)

Module Contents

class robokudo.utils.shape_estimator_adapters.SphereFitParameters

Parameters for fitting one sphere candidate.

distance_threshold: float
robust_loss: str
max_radius: float
max_radius_to_bbox_diagonal_ratio: float
max_radius_to_observed_extent_ratio: float
max_center_distance_to_bbox_diagonal_ratio: float
min_inlier_ratio: float
class robokudo.utils.shape_estimator_adapters.CylinderFitParameters

Parameters for fitting one cylinder candidate.

distance_threshold: float
robust_loss: str
max_radius: float
max_height: float
max_radius_to_bbox_diagonal_ratio: float
max_radius_to_cross_section_extent_ratio: float
max_axis_center_distance_to_bbox_diagonal_ratio: float
min_inlier_ratio: float
max_initializations: int
consensus_trials: int
inlier_polishing_iterations: int
class robokudo.utils.shape_estimator_adapters.CuboidFitParameters

Parameters for fitting one cuboid candidate.

distance_threshold: float
max_extent: float
min_inlier_ratio: float
robokudo.utils.shape_estimator_adapters.ShapeFitParameters
class robokudo.utils.shape_estimator_adapters.ShapeFitSummary

Bases: abc.ABC

Shared compact metrics for one fitted shape candidate.

score: float

Fit quality score.

inlier_ratio: float

Ratio of input points explained by the fitted shape.

root_mean_square_error: float

Root mean square distance error of inlier points.

property shape_name: str
Abstractmethod:

Name of the fitted shape.

abstract shape_specific_fields() tuple[tuple[str, object, str | None], Ellipsis]

Return fields that only apply to this fitted shape.

__str__() str

Return the compact log representation.

class robokudo.utils.shape_estimator_adapters.SphereFitSummary

Bases: ShapeFitSummary

Compact metrics for one fitted sphere candidate.

radius: float

Fitted sphere radius.

property shape_name: str

Name of the fitted shape.

shape_specific_fields() tuple[tuple[str, object, str | None], Ellipsis]

Return fields that only apply to this fitted shape.

class robokudo.utils.shape_estimator_adapters.CylinderFitSummary

Bases: ShapeFitSummary

Compact metrics for one fitted cylinder candidate.

radius: float

Fitted cylinder radius.

height: float

Fitted cylinder height.

property shape_name: str

Name of the fitted shape.

shape_specific_fields() tuple[tuple[str, object, str | None], Ellipsis]

Return fields that only apply to this fitted shape.

class robokudo.utils.shape_estimator_adapters.CuboidFitSummary

Bases: ShapeFitSummary

Compact metrics for one fitted cuboid candidate.

extents: list[float]

Fitted cuboid side lengths.

property shape_name: str

Name of the fitted shape.

shape_specific_fields() tuple[tuple[str, object, str | None], Ellipsis]

Return fields that only apply to this fitted shape.

class robokudo.utils.shape_estimator_adapters.ShapeFitAdapter

Bases: abc.ABC

Shape-specific behavior for one fitted primitive type.

shape_name: str
abstract matches(fit_result: robokudo.utils.shape_fitting.FittedShape) bool

Return whether this adapter handles the fit result.

abstract fit(points: numpy.ndarray, parameters: ShapeFitParameters) typing_extensions.Optional[robokudo.utils.shape_fitting.FittedShape]

Fit this primitive using shape-specific fit parameters.

abstract to_annotation(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.types.annotation.Shape

Convert a fit result into a RoboKudo shape annotation.

abstract to_o3d_geometry(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.Geometry

Convert a fitted primitive into an Open3D geometry.

abstract to_coordinate_frame(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.TriangleMesh

Create a coordinate frame located at the fitted primitive center.

abstract summary(fit_result: robokudo.utils.shape_fitting.FittedShape) ShapeFitSummary

Return compact metrics for one fitted candidate.

class robokudo.utils.shape_estimator_adapters.SphereFitAdapter

Bases: ShapeFitAdapter

Adapter for sphere fit results.

shape_name = 'Sphere'
matches(fit_result: robokudo.utils.shape_fitting.FittedShape) bool

Return whether this adapter handles the fit result.

fit(points: numpy.ndarray, parameters: ShapeFitParameters) typing_extensions.Optional[robokudo.utils.shape_fitting.SphereFit]

Fit one sphere candidate.

to_annotation(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.types.annotation.Sphere

Create a sphere annotation from a sphere fit.

to_o3d_geometry(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.Geometry

Convert a fitted sphere into an Open3D geometry.

to_coordinate_frame(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.TriangleMesh

Create a coordinate frame at the fitted sphere center.

summary(fit_result: robokudo.utils.shape_fitting.FittedShape) SphereFitSummary

Return compact metrics for one sphere fit.

class robokudo.utils.shape_estimator_adapters.CylinderFitAdapter

Bases: ShapeFitAdapter

Adapter for cylinder fit results.

shape_name = 'Cylinder'
matches(fit_result: robokudo.utils.shape_fitting.FittedShape) bool

Return whether this adapter handles the fit result.

fit(points: numpy.ndarray, parameters: ShapeFitParameters) typing_extensions.Optional[robokudo.utils.shape_fitting.CylinderFit]

Fit one cylinder candidate.

to_annotation(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.types.annotation.Cylinder

Create a cylinder annotation from a cylinder fit.

to_o3d_geometry(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.Geometry

Convert a fitted cylinder into an Open3D geometry.

to_coordinate_frame(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.TriangleMesh

Create a coordinate frame at the fitted cylinder center.

summary(fit_result: robokudo.utils.shape_fitting.FittedShape) CylinderFitSummary

Return compact metrics for one cylinder fit.

class robokudo.utils.shape_estimator_adapters.CuboidFitAdapter

Bases: ShapeFitAdapter

Adapter for cuboid fit results.

shape_name = 'Cuboid'
matches(fit_result: robokudo.utils.shape_fitting.FittedShape) bool

Return whether this adapter handles the fit result.

fit(points: numpy.ndarray, parameters: ShapeFitParameters) typing_extensions.Optional[robokudo.utils.shape_fitting.CuboidFit]

Fit one cuboid candidate.

to_annotation(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.types.annotation.Cuboid

Create a cuboid annotation from a cuboid fit.

to_o3d_geometry(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.Geometry

Convert a fitted cuboid into an Open3D geometry.

to_coordinate_frame(fit_result: robokudo.utils.shape_fitting.FittedShape) open3d.geometry.TriangleMesh

Create a coordinate frame at the fitted cuboid center.

summary(fit_result: robokudo.utils.shape_fitting.FittedShape) CuboidFitSummary

Return compact metrics for one cuboid fit.

robokudo.utils.shape_estimator_adapters.SPHERE_FIT_ADAPTER
robokudo.utils.shape_estimator_adapters.CYLINDER_FIT_ADAPTER
robokudo.utils.shape_estimator_adapters.CUBOID_FIT_ADAPTER
robokudo.utils.shape_estimator_adapters.SHAPE_FIT_ADAPTERS
robokudo.utils.shape_estimator_adapters.adapter_for_fit(fit_result: robokudo.utils.shape_fitting.FittedShape) ShapeFitAdapter

Return the adapter for a fitted primitive.

robokudo.utils.shape_estimator_adapters.rotation_matrix_from_axis(axis_direction: numpy.ndarray) numpy.ndarray

Create an orthonormal rotation matrix with z aligned to the axis.

robokudo.utils.shape_estimator_adapters._format_summary_value(value: object, format_spec: str | None) str

Format one summary value for compact log output.

robokudo.utils.shape_estimator_adapters._coordinate_frame(center: numpy.ndarray, rotation_matrix: numpy.ndarray, frame_size: float) open3d.geometry.TriangleMesh

Create a transformed Open3D coordinate frame.

robokudo.utils.shape_estimator_adapters._as_sphere_fit(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.utils.shape_fitting.SphereFit
robokudo.utils.shape_estimator_adapters._as_cylinder_fit(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.utils.shape_fitting.CylinderFit
robokudo.utils.shape_estimator_adapters._as_cuboid_fit(fit_result: robokudo.utils.shape_fitting.FittedShape) robokudo.utils.shape_fitting.CuboidFit
robokudo.utils.shape_estimator_adapters._as_sphere_fit_parameters(parameters: ShapeFitParameters) SphereFitParameters
robokudo.utils.shape_estimator_adapters._as_cylinder_fit_parameters(parameters: ShapeFitParameters) CylinderFitParameters
robokudo.utils.shape_estimator_adapters._as_cuboid_fit_parameters(parameters: ShapeFitParameters) CuboidFitParameters