即:如何使用 R & T 向量对 Point3D 进行仿射变换?

Viz: How to Affine Transform a Point3D with R & T vectors?

我正在尝试使用 OpenCV Viz 模块模拟 3D 相机的移动。我想在世界坐标中找到 3D 相机的位置!我这样指定相机的姿势!

如何从姿势 "Affine3d " 获取相机的位置?请注意,原点位于 Point3d(0,0,0)。我需要手动计算吗?如果是如何转换点?

    Mat RotationVector(1,3,CV_64FC1,Scalar(0.0));
    Mat TranslationVector(3,1,CV_64FC1,Scalar(1.0));
    Affine3d AffineTransform= Affine3d(RotationVector,TranslationVector);

    cout << "RotationVector: \n"        << RotationVector <<endl;
    cout << "TranslationVector: \n "    << TranslationVector <<endl;
    cout << "AffineTransform: \n"       << AffineTransform.matrix <<endl;

刚想通了!可以直接和Point3d相乘,像这样变换点。

Point3d Pt3D_Camera(0.0,0.0,0.0),
            Pt3D_Origin(0.0,0.0,0.0);
Mat RotationVector(1,3,CV_64FC1,Scalar(0.0));
Mat TranslationVector(3,1,CV_64FC1,Scalar(1.0));
Affine3d AffineTransform= Affine3d(RotationVector,TranslationVector);

Pt3D_Camera= AffineTransform* Pt3D_Origin;

cout << "RotationVector: \n"        << RotationVector <<endl;
cout << "TranslationVector: \n "    << TranslationVector <<endl;
cout << "AffineTransform: \n"       << AffineTransform.matrix <<endl;           
cout << "Pt3D_Camera: \n"           << Pt3D_Camera <<endl;