sksurgerysurfacematch.pipelines.register_cloud_to_stereo_mosaic module

Pipeline to register 3D point cloud to mosaic’ed surface reconstruction.

class sksurgerysurfacematch.pipelines.register_cloud_to_stereo_mosaic.Register3DToMosaicedStereoVideo(video_segmentor: sksurgerysurfacematch.interfaces.video_segmentor.VideoSegmentor, surface_reconstructor: sksurgerysurfacematch.algorithms.reconstructor_with_rectified_images.StereoReconstructorWithRectifiedImages, rigid_registration: sksurgerysurfacematch.interfaces.rigid_registration.RigidRegistration, left_camera_matrix: numpy.ndarray, right_camera_matrix: numpy.ndarray, left_to_right_rmat: numpy.ndarray, left_to_right_tvec: numpy.ndarray, min_number_of_keypoints: int = 25, max_fre_threshold=2, left_mask: numpy.ndarray = None, z_range: list = None, radius_removal: list = None, voxel_reduction: list = None)[source]

Bases: object

Class to register a point cloud to a series of surfaces derived from stereo video, and stitched together.

Uses Dependency Injection for each pluggable component.

Parameters:
  • video_segmentor – Optional class to pre-segment the video.
  • surface_reconstructor – Mandatory class to do reconstruction.
  • rigid_registration – Mandatory class to perform rigid alignment.
  • left_camera_matrix – [3x3] camera matrix.
  • right_camera_matrix – [3x3] camera matrix.
  • left_to_right_rmat – [3x3] left-to-right rotation matrix.
  • left_to_right_tvec – [1x3] left-to-right translation vector.
  • min_number_of_keypoints – Number of keypoints to use for matching.
  • max_fre_threshold – maximum FRE when stitching frames together.
  • left_mask – a static mask to apply to stereo reconstruction.
  • z_range – [min range, max range] to limit reconstructed points.
  • radius_removal – [radius, number] to reject points with too few neighbours
  • voxel_reduction – [vx, vy, vz] parameters for PCL

Voxel Grid reduction.

grab(left_image: numpy.ndarray, right_image: numpy.ndarray)[source]

Call this repeatedly to grab a surface and use ORM key points to match previous reconstruction to the current frame.

Parameters:
  • left_image – undistorted, BGR image
  • right_image – undistorted, BGR image
register(point_cloud: numpy.ndarray, initial_transform: numpy.ndarray = None)[source]

Registers a point cloud to the internal mosaicc’ed reconstruction.

Parameters:
  • point_cloud – [Nx3] points, each row, x,y,z, e.g. from CT/MR.
  • initial_transform – [4x4] of initial rigid transform.
Returns:

residual, [4x4] transform, of point_cloud to left camera space,

and [Mx6] reconstructed point cloud, as [x, y, z, r, g, b] rows.

reset()[source]

Reset’s internal data members, so that you can start accumulating data again.