# Revision history [back]

### cv2.calibratecamera throws error return without exception set

Hi,

I'm using openCV 2.4.10 and want to calibrate a camera. if I use cv2.calibrateCamera with flag=0 everything is fine. the named error occur if I try to set some flags and provide initial cameraMatrix and distCoeffs as input. below you find part of my code.

# create initial cameraMatrix and distCoeffs
cameraMatrix = np.zeros((3,3), dtype=np.float32)
cameraMatrix[0,0] = 1.0

distCoeffs = np.zeros((8,1), np.float64)

flag = 0
flag = flag | cv2.CALIB_USE_INTRINSIC_GUESS

# Find intrinsic and extrinsic camera parameters
# next line works fine
#rms, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, 0)
# in the following line the error occur
rms,cameraMatrix,distCoeffs,rvecs,tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, flag)


I used different versions for creating cameraMatrix and distCoeffs and also tried various flag settings all without success. I hope anybody has an idea where or what my error is. I would be glad for all help, because I'm stuck on this along time.

Greetings Maori

### cv2.calibratecamera throws throws: error return without exception set

Hi,

I'm using openCV 2.4.10 and want to calibrate a camera. if I use cv2.calibrateCamera with flag=0 everything is fine. the named error occur if I try to set some flags and provide initial cameraMatrix and distCoeffs as input. below you find part of my code.

# create initial cameraMatrix and distCoeffs
cameraMatrix = np.zeros((3,3), dtype=np.float32)
cameraMatrix[0,0] = 1.0

distCoeffs = np.zeros((8,1), np.float64)

flag = 0
flag = flag | cv2.CALIB_USE_INTRINSIC_GUESS

# Find intrinsic and extrinsic camera parameters
# next line works fine
#rms, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, 0)
# in the following line the error occur
rms,cameraMatrix,distCoeffs,rvecs,tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, flag)


I used different versions for creating cameraMatrix and distCoeffs and also tried various flag settings all without success. I hope anybody has an idea where or what my error is. I would be glad for all help, because I'm stuck on this along time.

Greetings Maori

### cv2.calibratecamera throws: error return without exception set

Hi,

I'm using openCV 2.4.10 and want to calibrate a camera. if I use cv2.calibrateCamera with flag=0 everything is fine. the named error occur if I try to set some flags and provide initial cameraMatrix and distCoeffs as input. below you find part of my code.

# create initial cameraMatrix and distCoeffs
cameraMatrix = np.zeros((3,3), dtype=np.float32)
cameraMatrix[0,0] = 1.0

distCoeffs = np.zeros((8,1), np.float64)

flag = 0
flag = flag | cv2.CALIB_USE_INTRINSIC_GUESS

# Find intrinsic and extrinsic camera parameters
# next line works fine
#rms, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, 0)
# in the following line the error occur
rms,cameraMatrix,distCoeffs,rvecs,tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, rms,camera_matrix,dist_coefs,rvecs,tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h),cameraMatrix, distCoeffs, flag)
flag)


to reproduce the error you could just copy and paste my code in the openCV sample. (C:\opencv\sources\samples\python2\calibrate.py)

I used different versions for creating cameraMatrix and distCoeffs and also tried various flag settings all without success. I hope anybody has an idea where or what my error is. I would be glad for all help, because I'm stuck on this along time.

Greetings Maori

### cv2.calibratecamera throws: error return without exception set

Hi,

I'm using openCV 2.4.10 and want to calibrate a camera. if I use cv2.calibrateCamera with flag=0 everything is fine. the named error occur if I try to set some flags and provide initial cameraMatrix and distCoeffs as input. below you find part of my code.

# create initial cameraMatrix and distCoeffs
cameraMatrix = np.zeros((3,3), dtype=np.float32)
cameraMatrix[0,0] = 1.0

distCoeffs = np.zeros((8,1), np.float64)
np.float32)

flag = 0
flag = flag | cv2.CALIB_USE_INTRINSIC_GUESS

# Find intrinsic and extrinsic camera parameters
# next line works fine
#rms, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, 0)
# in the following line the error occur
rms,camera_matrix,dist_coefs,rvecs,tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h),cameraMatrix, distCoeffs, flag)


to reproduce the error you could just copy and paste my code in the openCV sample. (C:\opencv\sources\samples\python2\calibrate.py)

I used different versions for creating cameraMatrix and distCoeffs and also tried various flag settings all without success. I hope anybody has an idea where or what my error is. I would be glad for all help, because I'm stuck on this along time.

Greetings Maori

### cv2.calibratecamera throws: error return without exception set

Hi,

I'm using openCV 2.4.10 and want to calibrate a camera. if I use cv2.calibrateCamera with flag=0 everything is fine. the named error occur if I try to set some flags and provide initial cameraMatrix and distCoeffs as input. below you find part of my code.

# create initial cameraMatrix and distCoeffs
cameraMatrix = np.zeros((3,3), dtype=np.float32)
cameraMatrix[0,0] = 1.0

distCoeffs = np.zeros((8,1), np.float32)

flag = 0
flag = flag | cv2.CALIB_USE_INTRINSIC_GUESS

# Find intrinsic and extrinsic camera parameters
# next line works fine
#rms, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, 0)
# in the following line the error occur
rms,camera_matrix,dist_coefs,rvecs,tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h),cameraMatrix, distCoeffs, flag)


to reproduce the error you could just copy and paste my code in the openCV sample. (C:\opencv\sources\samples\python2\calibrate.py)

I used different versions for creating cameraMatrix and distCoeffs and also tried various flag settings all without success. I hope anybody has an idea where or what my error is. I would be glad for all help, because I'm stuck on this along time.

Greetings Maori

edit: This question is solved. I missed some input parameters (rvecs, tvecs). got a hint from stackoverflow

### cv2.calibratecamera throws: error return without exception set

Hi,

I'm using openCV 2.4.10 and want to calibrate a camera. if I use cv2.calibrateCamera with flag=0 everything is fine. the named error occur if I try to set some flags and provide initial cameraMatrix and distCoeffs as input. below you find part of my code.

# create initial cameraMatrix and distCoeffs
cameraMatrix = np.zeros((3,3), dtype=np.float32)
cameraMatrix[0,0] = 1.0

distCoeffs = np.zeros((8,1), np.float32)

flag = 0
flag = flag | cv2.CALIB_USE_INTRINSIC_GUESS

# Find intrinsic and extrinsic camera parameters
# next line works fine
#rms, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(objectPoints, imagePoints, imageSize, 0)
# in the following line the error occur
rms,camera_matrix,dist_coefs,rvecs,tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h),cameraMatrix, distCoeffs, flag)
`

to reproduce the error you could just copy and paste my code in the openCV sample. (C:\opencv\sources\samples\python2\calibrate.py)

I used different versions for creating cameraMatrix and distCoeffs and also tried various flag settings all without success. I hope anybody has an idea where or what my error is. I would be glad for all help, because I'm stuck on this along time.

Greetings Maori

edit: This question is solved. I missed some input parameters (rvecs, tvecs). got a hint from stackoverflowhelp.