sksurgerycalibration.video.video_calibration_hand_eye module

Various routines for Hand-Eye calibration.

sksurgerycalibration.video.video_calibration_hand_eye.calibrate_hand_eye_and_grid_to_world(camera_rvecs: List[numpy.ndarray], camera_tvecs: List[numpy.ndarray], device_tracking_matrices: List[numpy.ndarray], method=0)[source]

Hand-eye calibration using standard OpenCV methods. This method assumes you have a stationary untracked calibration pattern, and a tracked device (e.g. laparoscope)

Parameters:camera_rvecs – list of rvecs that we get from OpenCV camera

extrinsics, pattern_to_camera. :param camera_tvecs: list of tvecs that we get from OpenCV camera extrinsics, pattern_to_camera. :param device_tracking_matrices: list of tracking matrices for the tracked device, e.g. laparoscope, marker_to_tracker. :param method: Choice of OpenCV RobotWorldHandEye method. :return hand-eye, grid-to-world transforms as 4x4 matrices

sksurgerycalibration.video.video_calibration_hand_eye.calibrate_hand_eye_and_pattern_to_marker(camera_rvecs: List[numpy.ndarray], camera_tvecs: List[numpy.ndarray], device_tracking_matrices: List[numpy.ndarray], pattern_tracking_matrices: List[numpy.ndarray], method=0)[source]

Hand-eye calibration using standard OpenCV methods. This method assumes you are tracking both the device that needs hand-eye calibration, and the calibration pattern.

Parameters:camera_rvecs – list of rvecs that we get from OpenCV camera

extrinsics, pattern_to_camera. :param camera_tvecs: list of tvecs that we get from OpenCV camera extrinsics, pattern_to_camera. :param device_tracking_matrices: list of tracking matrices for the tracked device, e.g. laparoscope, marker_to_tracker. :param pattern_tracking_matrices: list of tracking matrices for the calibration object, marker_to_tracker :param method: Choice of OpenCV RobotWorldHandEye method. :return hand-eye, pattern-to-marker transforms as 4x4 matrices

sksurgerycalibration.video.video_calibration_hand_eye.calibrate_hand_eye_using_stationary_pattern(camera_rvecs: List[numpy.ndarray], camera_tvecs: List[numpy.ndarray], tracking_matrices: List[numpy.ndarray], method=0, invert_camera=False)[source]

Hand-eye calibration using standard OpenCV methods. This method assumes a single set of tracking data, so it is useful for a stationary, untracked calibration pattern, and a tracked video device, e.g. laparoscope.

Parameters:camera_rvecs – list of rvecs that we get from OpenCV camera

extrinsics, pattern_to_camera. :param camera_tvecs: list of tvecs that we get from OpenCV camera extrinsics, pattern_to_camera. :param tracking_matrices: list of tracking matrices for the tracked device, marker_to_tracker. :param method: Choice of OpenCV Hand-Eye method. :param invert_camera: if True, we invert camera matrices before hand-eye calibration. :return hand-eye transform as 4x4 matrix.

sksurgerycalibration.video.video_calibration_hand_eye.calibrate_hand_eye_using_tracked_pattern(camera_rvecs: List[numpy.ndarray], camera_tvecs: List[numpy.ndarray], device_tracking_matrices: List[numpy.ndarray], pattern_tracking_matrices: List[numpy.ndarray], method=0)[source]

Hand-eye calibration using standard OpenCV methods. This method assumes two sets of tracking data, so it is useful for a tracked device (e.g. laparoscope) and a tracked calibration object (e.g. chessboard).

Parameters:camera_rvecs – list of rvecs that we get from OpenCV camera

extrinsics, pattern_to_camera. :param camera_tvecs: list of tvecs that we get from OpenCV camera extrinsics, pattern_to_camera. :param device_tracking_matrices: list of tracking matrices for the tracked device, marker_to_tracker. :param pattern_tracking_matrices: list of tracking matrices for the tracked calibration object, marker_to_tracker. :param method: Choice of OpenCV Hand-Eye method. :return hand-eye transform as 4x4 matrix.

sksurgerycalibration.video.video_calibration_hand_eye.calibrate_pattern_to_tracking_marker(camera_rvecs: List[numpy.ndarray], camera_tvecs: List[numpy.ndarray], tracking_matrices: List[numpy.ndarray], method=0)[source]

In some calibration problems, people use a pattern (e.g. chessboard) that is tracked. If you manufacture this well, you should know the pattern_2_marker transform by DESIGN. However, if you assume a STATIONARY video camera, and a moving pattern, this method allows you to use standard hand-eye techniques to estimate the pattern_2_marker transform from at least 2 motions (3 views) around different axes of rotation.

Parameters:camera_rvecs – list of rvecs that we get from OpenCV camera

extrinsics, pattern_to_camera. :param camera_tvecs: list of tvecs that we get from OpenCV camera extrinsics, pattern_to_camera. :param tracking_matrices: list of tracking matrices for the tracked calibration pattern, marker_to_tracker. :param method: Choice of OpenCV Hand-Eye method. :return pattern_to_marker

sksurgerycalibration.video.video_calibration_hand_eye.guofang_xiao_handeye_calibration(rvecs: List[numpy.ndarray], tvecs: List[numpy.ndarray], quat_model2hand_array: numpy.ndarray, trans_model2hand_array: numpy.ndarray) → Tuple[numpy.ndarray, numpy.ndarray][source]

Guofang Xiao’s method. Solve for the hand-eye transformation, as well as the transformation from the pattern to the tracking markers on the calibration object.

This method, developed for the SmartLiver project, assumes both device (laparoscope), and the calibration object are tracked. We also, keep the device (laparoscope) stationary while moving the calibration object.

Parameters:rvecs – Array of rotation vectors, from OpenCV, camera extrinsics

(pattern to camera transform) :type rvecs: List[np.ndarray] :param tvecs: Array of translation vectors, from OpenCV, camera extrinsics (pattern to camera transform) :type tvecs: List[np.ndarray] :param quat_model2hand_array: Array of quaternions representing rotational part of marker-to-hand. :type quat_model2hand_array: np.ndarray :param trans_model2hand_array: Array of quaternions representing translational part of marker-to-hand. :type trans_model2hand_array: np.ndarray :return: two 4x4 matrices as np.ndarray, representing handeye_matrix, pattern2marker_matrix :rtype: np.ndarray, np.ndarray

sksurgerycalibration.video.video_calibration_hand_eye.set_model2hand_arrays(calibration_tracking_array: List[T], device_tracking_array: List[T], use_quaternions=False) → Tuple[numpy.ndarray, numpy.ndarray][source]

Guofang Xiao’s method. Set the model-to-hand quaternion and translation arrays from tracking data.

Parameters:calibration_tracking_array – Array of tracking data for

calibration target :type calibration_tracking_array: List of tracking data :param device_tracking_array: Array of tracking data for device (e.g. camera) :type device_tracking_array: List of tracking data :param use_quaternions: If True input should be quaternions :type device_tracking_array: bool :return: quaternion model to hand array and translation model to hand array :rtype: np.ndarray, np.ndarray