Ask Your Question
0

cv2.calibratecamera throws: error return without exception set

asked 2015-04-13 09:49:44 -0600

Maori gravatar image

updated 2015-04-16 03:08:45 -0600

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-04-16 03:07:20 -0600

Maori gravatar image

got a hint from stackoverflow. I missed some parameters (rvecs, tvecs) for the function. function prototype: cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]])

its really a beginner mistake but the error message wasn't very helpful.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-04-13 09:49:44 -0600

Seen: 877 times

Last updated: Apr 16 '15