我正在尝试在我的图像上投影一些3d点。为此,我使用OpenCV的projectPoints方法。此函数返回的uv坐标值偏高(±e12)。
这是函数调用
image_points = cv2.projectPoints(objectPoints=object_points, rvec=rvec, tvec=tvec, cameraMatrix=K, distCoeffs=distortionCoefficients)
在这里,我已经打印了所有参数和生成的数字:
------------------ project points parameters ------------------
object_points
array([[ 46.22355289, -16.91716111, -2.82987621],
[ 43.78832261, -13.05850379, -2.82991462],
[ 37.07163144, -2.41386808, -2.83002055],
[ 37.0715428 , -2.4138769 , 1.90501117],
[ 43.78815898, -13.05852006, 5.91114394],
[ 46.22341644, -16.91717469, 4.45917262],
[ 46.22355289, -16.91716111, -2.82987621]])
rvec
array([0., 0., 0.])
tvec
array([0., 0., 0.])
camera matrix
array([[3.31448768e+03, 0.00000000e+00, 2.11145044e+03],
[0.00000000e+00, 3.32249862e+03, 1.49983176e+03],
[0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
dist coeff
array([ 0.2259219 , -0.9247832 , -0.00545379, 0.00127311, 1.078296 ])
------------------ project points results ------------------
array([[[-1.61201971e+12, 5.91402161e+11]],
[[-9.76843272e+11, 2.92017176e+11]],
[[-2.38378863e+11, 1.55592241e+10]],
[[ 3.81670677e+12, -2.49121760e+11]],
[[ 5.56809216e+09, -1.66453065e+09]],
[[ 6.65464992e+10, -2.44140259e+10]],
[[-1.61201971e+12, 5.91402161e+11]]])
图像尺寸为4160x3120。使用OpenCV的undistort方法,未失真的图像看起来很完美。
答案 0 :(得分:0)
我假设坐标系错误。 该函数使用以下坐标系:https://www.researchgate.net/figure/Pinhole-camera-model_fig1_265107440 因此某些轴已切换...