Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SystemError: new style getargs format but argument is not a tuple

I'm trying to use my own calibration values for stereo calibration, but I keep getting this not a tuple error and I'm not sure how to solve it. I get that the input values are np arrays' and not tuples, but I don't get how to format them to be tuples.

class stereoCal:
  def __init__(self):
    self.cam_mats = {}
    self.dist_coefs = {}
    self.rect_trans = {}
    self.proj_mats = {}
    self.valid_boxes = {"left": None, "right": None}

def main():
    print("welcome")

    calib = stereoCal()

    calib.cam_mats["left"] = np.matrix('795.38093599,0.0, 634.64515188; 0.0, 795.38093599, 368.69325648; 0.0, 0.0, 1.0')
    calib.dist_coefs["left"] = np.matrix('-0.02427449,-0.16218051, 0.0, 0.0, -0.02218827')
    calib.cam_mats["right"] = np.matrix('795.38093599,0.0, 635.53238221; 0.0, 795.38093599, 367.11772793; 0.0, 0.0,1.')
    calib.dist_coefs["right"] = np.matrix('-0.02031345, -0.20648403, 0.0, 0.0, 0.06187535')
    calib.image_size = np.matrix('1280, 720')#eric guessing at format
    calib.rot_mat = np.matrix('0.99888139, 0.03874155, -0.02711195; -0.03934705, 0.99897968, -0.02216774; 0.02622548, 0.02320972, 0.99938658')
    calib.trans_vec = np.matrix('-5.40627446, 0.21677134, 0.5121689')

    (calib.rect_trans["left"], calib.rect_trans["right"],
    calib.proj_mats["left"], calib.proj_mats["right"],
    calib.disp_to_depth_mat, calib.valid_boxes["left"],
    calib.valid_boxes["right"]) = cv2.stereoRectify(calib.cam_mats["left"],calib.dist_coefs["left"],calib.cam_mats["right"],calib.dist_coefs["right"],calib.image_size,calib.rot_mat,calib.trans_vec,flags=0)

if __name__ == "__main__":
    main()