为什么我的代码片段对于预测点给出了奇怪的结果?
//Generate the one 3D Point which i want to project onto 2D plane
vector<Point3d> points_3d;
points_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);
//Generate the identity matrix and zero vector for rotation matrix and translation vector
Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));
Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));
//Generate a camera intrinsic matrix
Mat K = (Mat_<double>(3,3)
<< (1000, 0, 50,
0, 1000, 50,
0, 0, 1));
//Project the 3D Point onto 2D plane
Mat points_2d;
projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);
//Output
cout << points_2d;
我得到了预期的二维点
points_2d = (-1.708699427820658e+024, -9.673395654445999e-026)
this
。 - alkasmpoints_2d = [-2.189252230068162, 2.108690908231197e-026]
- Mirnyycv :: Mat K2 =(cv :: Mat_ <double>(3,3)<< 1000,0,50,0,1000,50,0,0,1);
,然后我得到了您想要的points_2d = [150, 150]。 - Artur