sksurgerycalibration.video.video_calibration_driver_mono module

Class to do stateful video calibration of a mono camera.

class sksurgerycalibration.video.video_calibration_driver_mono.MonoVideoCalibrationDriver(point_detector: sksurgeryimage.calibration.point_detector.PointDetector, minimum_points_per_frame: int)[source]

Bases: sksurgerycalibration.video.video_calibration_driver_base.BaseVideoCalibrationDriver

Class to do stateful video calibration of a mono camera.

calibrate(flags=0)[source]

Do the video calibration, returning RMS re-projection error.

Parameters:flags – OpenCV calibration flags, eg. cv2.CALIB_FIX_ASPECT_RATIO
Returns:RMS projection
grab_data(image, device_tracking=None, calibration_object_tracking=None)[source]

Extracts points, by passing it to the PointDetector.

This will throw various exceptions if the input data is invalid, but will return empty arrays if no points were detected. So, no points is not an error. Its an expected condition.

Parameters:
  • image – RGB image.
  • device_tracking – transformation for the tracked device
  • calibration_object_tracking – transformation of tracked

calibration object :return: The number of points grabbed.

handeye_calibration(override_pattern2marker=None, use_opencv: bool = True, do_bundle_adjust: bool = False)[source]

Do handeye calibration, returning RMS re-projection error.

Note: This handeye_calibration on this class assumes you are tracking both the calibration pattern (e.g. chessboard) and the device (e.g. laparoscope). So, the calibration routines calibrate for hand2eye and pattern2marker. If you want something more customised, work with video_calibration_hand_eye.py.

Parameters:override_pattern2marker – If provided a 4x4 pattern2marker

that is taken as constant. :param use_opencv: If True we use OpenCV based methods, if false, Guofang Xiao’s method. :param do_bundle_adjust: If True we do an additional bundle adjustment at the end.

Returns:RMS reprojection error
Return type:float
iterative_calibration(number_of_iterations: int, reference_ids, reference_image_points, reference_image_size, flags: int = 0)[source]

Does iterative calibration, like Datta 2009, returning RMS re-projection error. :return: RMS projection