robokudo.annotators.sift_annotator

Classes

SIFTAnnotator

Annotator for SIFT feature extraction and matching using OpenCV.

Module Contents

class robokudo.annotators.sift_annotator.SIFTAnnotator(name: str = 'SIFTAnnotator')

Bases: robokudo.annotators.core.ThreadedAnnotator

Annotator for SIFT feature extraction and matching using OpenCV.

_sift: cv2.SIFT

SIFT feature extractor.

compute() py_trees.common.Status

Compute the SIFT features of the current image and match them to the last image.

Returns:

The status of the computation.

_draw_visualization(color_image: numpy.typing.NDArray[numpy.uint8], vis_image: numpy.typing.NDArray[numpy.uint8], current_kp: typing_extensions.Sequence[cv2.KeyPoint]) numpy.typing.NDArray[numpy.uint8]

Add visualizations to the image.

Parameters:
  • color_image – The current color image.

  • vis_image – The image to add visualizations to.

  • current_kp – The keypoints from the current image.

Returns:

The image with visualizations.

_keypoints_to_point_cloud(keypoints: typing_extensions.List[cv2.KeyPoint], depth_image: numpy.typing.NDArray, intrinsics: open3d.camera.PinholeCameraIntrinsic, depth_ratio: typing_extensions.Tuple[float, float] = (1.0, 1.0), depth_scale: float = 1000.0, max_depth: float = 3.0) open3d.geometry.PointCloud

Project the keypoints to a 3D point cloud.

Parameters:
  • keypoints – The keypoints to project to 3D.

  • depth_image – The depth image used for projection.

  • intrinsics – The camera intrinsics used for projection.

  • depth_ratio – The ratio of the depth image to the color image.

  • depth_scale – The depth scale of the depth image.

  • max_depth – The maximum depth to project.

Returns:

The 3D point cloud.

static _keypoint_colors(keypoints: typing_extensions.List[cv2.KeyPoint], responses: numpy.typing.NDArray) numpy.typing.NDArray[numpy.float64]

Get rgb colors for keypoints based on their responses and angles.

Parameters:
  • keypoints – The keypoints.

  • responses – The keypoints responses.

Returns:

The rgb colors.