openCV Python: cv2.calibrateCamera: 错误 return 无一例外
openCV Python: cv2.calibrateCamera: error return without exception
我正在使用 openCV 2.4.10 并想要校准相机。如果我使用 cv2.calibrateCamera 和 flag=0 一切都很好。如果我尝试设置一些标志并提供初始 cameraMatrix 和 distCoeffs 作为输入,则会发生命名错误。在下面你可以找到我的部分代码。
# 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(obj_points, img_points, (w,h), 0)
# the following line throw the error
rms,camera_matrix,dist_coefs,rvecs,tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h),cameraMatrix, distCoeffs, flag)
我使用了不同的版本来创建 cameraMatrix 和 distCoeffs,还尝试了各种标志设置,但都没有成功。我希望任何人都知道我的错误在哪里或什么。我很乐意提供所有帮助,因为我一直坚持这个。
你好毛利人
查看函数原型:
cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]])
您在标志之前错过了 rvecs、tvecs。
我正在使用 openCV 2.4.10 并想要校准相机。如果我使用 cv2.calibrateCamera 和 flag=0 一切都很好。如果我尝试设置一些标志并提供初始 cameraMatrix 和 distCoeffs 作为输入,则会发生命名错误。在下面你可以找到我的部分代码。
# 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(obj_points, img_points, (w,h), 0)
# the following line throw the error
rms,camera_matrix,dist_coefs,rvecs,tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h),cameraMatrix, distCoeffs, flag)
我使用了不同的版本来创建 cameraMatrix 和 distCoeffs,还尝试了各种标志设置,但都没有成功。我希望任何人都知道我的错误在哪里或什么。我很乐意提供所有帮助,因为我一直坚持这个。
你好毛利人
查看函数原型:
cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]])
您在标志之前错过了 rvecs、tvecs。