gpt4 book ai didi

python - 仅径向变形即可校准摄像机

转载 作者:行者123 更新时间:2023-12-02 17:43:30 26 4
gpt4 key购买 nike

我正在尝试在python中使用opencv运行相机校准。我正在使用:

cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)

似乎对于5个失真系数来说效果很好。但是,我想尝试并在没有切向畸变并且可能只有2个径向畸变系数的情况下运行它。那可能吗?

最佳答案

我找到了答案。

对于无切向失真:

 ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None, 4,None,None,cv2.CALIB_ZERO_TANGENT_DIST,
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 2e-16))

对于仅2个径向变形系数,似乎文档建议使用4个而不是5个系数。这似乎不起作用。相反,我修复了k3参数:
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None, 4,None,None,cv2.CALIB_ZERO_TANGENT_DIST+cv2.CALIB_FIX_K3,
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 2e-16))

关于python - 仅径向变形即可校准摄像机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40775102/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com