Ask Your Question

Maori's profile - activity

2015-04-16 03:07:20 -0600 answered a question cv2.calibratecamera throws: error return without exception set

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.

2015-04-16 03:07:20 -0600 received badge  Enthusiast
2015-04-13 09:54:16 -0600 received badge  Editor (source)
2015-04-13 09:49:44 -0600 asked a question 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.

2015-02-25 10:01:45 -0600 received badge  Critic (source)
2015-02-19 07:54:17 -0600 received badge  Supporter (source)
2015-02-19 03:46:06 -0600 commented question calculate distance between two objects in a image using single camera

I guess that the problem is in the conversion pixels to cm. how have you done it?