def __init__(self, java_object=None): self.left = pyboof.Intrinsic() self.right = pyboof.Intrinsic() self.right_to_left = pyboof.Se3_F64() if java_object is not None: self.set_from_boof(java_object)
def __init__(self, intrinsic_left, intrinsic_right, right_to_left): """ Configures rectification :param intrinsic_left: Intrinsic parameters for left camera :type intrinsic_left: pyboof.CameraPinhole :param intrinsic_right: Intrinsic parameters for right camera :type intrinsic_right: pyboof.CameraPinhole :param right_to_left: Extrinsic parameters for right to left camera :type right_to_left: pyboof.Se3_F64 """ boof_left = intrinsic_left.convert_to_boof() boof_right = intrinsic_right.convert_to_boof() K1 = gateway.jvm.org.ejml.data.DMatrixRMaj(3, 3) K2 = gateway.jvm.org.ejml.data.DMatrixRMaj(3, 3) gateway.jvm.boofcv.alg.geo.PerspectiveOps.pinholeToMatrix(boof_left, K1) gateway.jvm.boofcv.alg.geo.PerspectiveOps.pinholeToMatrix(boof_right, K2) left_to_right = right_to_left.invert() rectify_alg = gateway.jvm.boofcv.alg.geo.RectifyImageOps.createCalibrated() rectify_alg.process(K1, pyboof.Se3_F64().java_obj, K2, left_to_right.get_java_object()) self.intrinsic_left = intrinsic_left self.intrinsic_right = intrinsic_right self.orig_rect1 = rectify_alg.getUndistToRectPixels1() self.orig_rect2 = rectify_alg.getUndistToRectPixels2() self.orig_rectK = rectify_alg.getCalibrationMatrix() self.rect1 = self.orig_rect1.copy() self.rect2 = self.orig_rect2.copy() self.rectK = self.orig_rectK.copy()
def __init__(self, java_object=None): self.left = pyboof.CameraPinhole() self.right = pyboof.CameraPinhole() self.right_to_left = pyboof.Se3_F64() if java_object is not None: self.set_from_boof(java_object)
def process(self, data_set): # TODO use type information (not available yet) to convert the dataset. java_list = pyboof.p2b_list_AssociatedPair(data_set) if not self.java_obj.process(java_list): return False # TODO convert model based on model type info self.model_parameters = pyboof.Se3_F64(self.java_obj.getModelParameters()) self.match_set = pyboof.b2p_list_AssociatedPair(self.java_obj.getMatchSet()) self.input_indexes = [0]*len(self.match_set) for i in range(len(self.input_indexes)): self.input_indexes[i] = self.java_obj.getInputIndex(i) self.fit_quality = self.java_obj.getFitQuality() return True
def __init__(self, intrinsic_left, intrinsic_right, right_to_left): """ Configures rectification :param intrinsic_left: Intrinsic parameters for left camera :type intrinsic_left: pyboof.Intrinsic :param intrinsic_right: Intrinsic parameters for right camera :type intrinsic_right: pyboof.Intrinsic :param right_to_left: Extrinsic parameters for right to left camera :type right_to_left: pyboof.Se3_F64 """ boof_left = intrinsic_left.convert_to_boof() boof_right = intrinsic_right.convert_to_boof() K1 = gateway.jvm.boofcv.alg.geo.PerspectiveOps.calibrationMatrix( boof_left, None) K2 = gateway.jvm.boofcv.alg.geo.PerspectiveOps.calibrationMatrix( boof_right, None) left_to_right = right_to_left.invert() rectify_alg = gateway.jvm.boofcv.alg.geo.RectifyImageOps.createCalibrated( ) rectify_alg.process(K1, pyboof.Se3_F64().java_obj, K2, left_to_right.get_java_object()) self.intrinsic_left = intrinsic_left self.intrinsic_right = intrinsic_right self.orig_rect1 = rectify_alg.getRect1() self.orig_rect2 = rectify_alg.getRect2() self.orig_rectK = rectify_alg.getCalibrationMatrix() self.rect1 = self.orig_rect1.copy() self.rect2 = self.orig_rect2.copy() self.rectK = self.orig_rectK.copy()
def set_from_boof(self, boof_stereo_param): self.left.set_from_boof(boof_stereo_param.getLeft()) self.right.set_from_boof(boof_stereo_param.getRight()) self.right_to_left = pyboof.Se3_F64(boof_stereo_param.getRightToLeft())