sksurgeryimage.acquire.stereo_video module

Module for stereo video source acquisition.

class sksurgeryimage.acquire.stereo_video.StereoVideo(layout, channels, dims=None)[source]

Bases: object

Provides a convenient object to manage various stereo input styles. Developed firstly for laparoscopic surgery, but broadly applicable to any stereo setup using our TimestampedVideoSource and VideoSourceWrapper.

Design Principles:

  1. Fail early, throwing exceptions for all errors.
  2. Works with or without camera parameters.
  3. If no camera parameters, calling get_undistorted() or get_rectified() is an Error.
get_images()[source]

Returns the 2 channels, unscaled, as a list of images.

Returns:list of images
get_rectified()[source]

Returns the 2 channels, rectified, as a list of images.

Returns:list of images
Raises:ValueError, TypeError - if camera parameters are not set.
get_scaled()[source]

Returns the 2 channels, scaled, as a list of images.

Returns:list of images
get_undistorted()[source]

Returns the 2 channels, undistorted, as a list of images.

Returns:list of images
Raises:ValueError - if you haven’t already provided camera parameters
grab()[source]

Asks internal VideoSourceWrapper to grab images.

release()[source]

Asks internal VideoSourceWrapper to release all sources.

retrieve()[source]

Asks internal VideoSourceWrapper to retrieve images.

set_extrinsic_parameters(rotation, translation, dims)[source]

Sets the stereo extrinsic parameters.

Parameters:
  • rotation – 3x3 numpy array representing rotation matrix.
  • translation – 3x1 numpy array representing translation vector.
  • dims – new image size for rectification
Raises:

ValueError, TypeError

set_intrinsic_parameters(camera_matrices, distortion_coefficients)[source]

Sets both sets of intrinsic parameters.

Parameters:
  • camera_matrices – list of 2, 3x3 numpy arrays.
  • distortion_coefficients – list of 2, 1xN numpy arrays.
Raises:

ValueError, TypeError

class sksurgeryimage.acquire.stereo_video.StereoVideoLayouts[source]

Bases: object

Class to hold some constants, like an enum.

DUAL = 0
INTERLACED = 1
VERTICAL = 2