Dan*_*Lee 4 python opencv camera-calibration
我在使用用于OpenCV的Python绑定的校准相机拍摄的图像上没有失真点.未失真的点具有与图像中检测到的原始点完全不同的坐标.
这是违规的电话:
undistorted = cv2.undistortPoints(image_points,
camera_matrix,
distortion_coefficients)
Run Code Online (Sandbox Code Playgroud)
哪里image_points是一个由检测到的棋盘角落的numpy数组返回cv2.findChessboardCorners并重新整形以匹配尺寸要求cv2.undistortPoints,camera_matrix并且distortion_coefficients被返回cv2.calibrateCamera.
camera_matrix而distortion_coefficients在我看来,会好起来的,等做image_points.然而,distorted似乎没有任何关系image_points.以下是值的摘要:
>>> image_points
array([[[ 186.95303345, 163.25502014]],
[[ 209.54478455, 164.62690735]],
[[ 232.26443481, 166.10734558]],
...,
[[ 339.03695679, 385.97784424]],
[[ 339.20108032, 400.38635254]],
[[ 339.13067627, 415.30780029]]], dtype=float32)
>>> undistorted
array([[[-0.19536583, -0.07900728]],
[[-0.16608481, -0.0772614 ]],
[[-0.13660771, -0.07537176]],
...,
[[ 0.00228534, 0.21044853]],
[[ 0.00249786, 0.22910291]],
[[ 0.00240568, 0.24841554]]], dtype=float32)
>>> camera_matrix
array([[ 767.56947802, 0. , 337.27849576],
[ 0. , 767.56947802, 224.04766824],
[ 0. , 0. , 1. ]])
>>> distortion_coefficients
array([[ 0.06993424, -0.32645465, 0. , 0. , -0.04310827]])
Run Code Online (Sandbox Code Playgroud)
我正在使用参考C代码,所有内容都匹配,直到我拨打电话.出了什么问题?
我想您忘记在通话中指定新的相机矩阵undistortPoints.如果你查看函数的文档,它会说签名是:
Python: cv.UndistortPoints(src, dst, cameraMatrix, distCoeffs, R=None, P=None) ? None
Run Code Online (Sandbox Code Playgroud)
其中dst是非失真后的点阵列和"如果P是同一性或省略,则它包含归一化点坐标",意味着在使用校准矩阵在图像中投影之前.
如果设置P为您的功能,该功能应该按照您的预期执行cameraMatrix.
| 归档时间: |
|
| 查看次数: |
2583 次 |
| 最近记录: |