TypeError: R is not a numpy array, neither a scalar
I am trying to do stereo fish eye camera calibration using OpenCV and Python Here is my code:
Main part of the code for stereo calibration
N_OK = len(leftImagePoints)
objecPoints = np.array([objectPoints]*len(leftImagePoints), dtype=np.float64)
leftImagePoints=np.asarray(leftImagePoints, dtype=np.float64)
rightImagePoints=np.asarray(rightImagePoints, dtype=np.float64)
objectPoints = np.reshape(objectPoints,(N_OK, 1, CHESSBOARD_SIZE[0]*CHESSBOARD_SIZE[1],3))
leftImagePoints = np.reshape(leftImagePoints, (N_OK, 1, CHESSBOARD_SIZE[0]*CHESSBOARD_SIZE[1], 2))
rightImagePoints = np.reshape(rightImagePoints,(N_OK, 1, CHESSBOARD_SIZE[0]*CHESSBOARD_SIZE[1], 2))
K_left = np.zeros((3, 3))
D_left = np.zeros((4, 1))
K_right = np.zeros((3, 3))
D_right = np.zeros((4, 1))
R = [np.zeros((1, 1, 3), dtype=np.float64) for i in range(MAX_IMAGES)]
T = [np.zeros((1, 1, 3), dtype=np.float64) for i in range(MAX_IMAGES)]
print("Calibrating left fisheye camera...")
rms, _, _, _, _ = cv2.fisheye.calibrate(objectPoints,leftImagePoints,imageSize, K_left,D_left,R,T,calibration_flags, (cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6))
print("calibrating right fisheye camera...")
rms, _, _, _, _ = cv2.fisheye.calibrate(objectPoints,rightImagePoints, imageSize,K_right,D_right,R,T,calibration_flags, (cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6))
print("calibrating both fisheye cameras together...")
(rms, _, _, _, _) = \
cv2.fisheye.stereoCalibrate(
objectPoints,
leftImagePoints,
rightImagePoints,
K_left,
D_left,
K_right,
D_right,
imageSize,
R,
T,
(cv2.fisheye.CALIB_RECOMPUTE_EXTRINSIC + cv2.fisheye.CALIB_CHECK_COND + cv2.fisheye.CALIB_FIX_SKEW)
);
*error: -Traceback (most recent call last): File "fisheye_calib1.py", line 176, in <module> (cv2.fisheye.CALIB_RECOMPUTE_EXTRINSIC + cv2.fisheye.CALIB_CHECK_COND + cv2.fisheye.CALIB_FIX_SKEW) TypeError: R is not a numpy array, neither a scalar *
I am able to do calibration of individual camera but it is throwing errors when it comes to stereo fisheye camera calibration. ' Have I declared R & T in right manner' It is giving error (SystemError: new style getrags format but argument is not a tuple) If anyone could guide me with this would be great help.
please tell us WHERE the error happens.
(i'm afraid, noone will actually try your 200 line monster)
we also need the exact error msg.
I have edited my code with error.