OpenCV 将 3D 坐标投影到 2d 相机坐标

OpenCV project 3D coordinates to 2d camera coordinates

我有一个物体的 3D 世界坐标,我想获得它在相机 2D 平面中的坐标。 我已经使用 cv::calibrateCamera 校准了相机,所以我有 相机矩阵 distortionCoeffs

为了将 3D 点投影到 2d 相机坐标,我使用 cv::projectPointsDocumentation 说:

void projectPoints(InputArray objectPoints, InputArray rvec, InputArray tvec, InputArray cameraMatrix, InputArray distCoeffs, OutputArray imagePoints, OutputArray jacobian=noArray(), double aspectRatio=0 )

如何获得 rvec/tvec,我的方法是否正确?calibrateCamera给我 rvecstvecs,但它们是对于每个输入的棋盘图像,我猜,它们是棋盘的旋转和平移,而不是相机的旋转和平移。

因为我有 投影矩阵 (P),所以我可以像这样从3D坐标X(使用齐次坐标):

x (u,v,w) = P * X (x1,x2,x3,w)

我只是有一个校正问题,所以我无法准确投影到我的 2d 图像。看这里:OpenCV stereo vision 3D coordinates to 2D camera-plane projection different than triangulating 2D points to 3D