我从两个相机捕获的两个图像,使得一定距离分开,捕获相同的场景。我想计算两个相机之间的真实世界旋转和翻译。为了实现这一目标,我首先提取了两个图像的SIFT特征并匹配它们。

我现在有基本矩阵以及 homate矩阵。然而,无法进一步进一步,很多混乱。任何人都可以帮助我估计两个相机之间的旋转和翻译

我正在使用OpenCV进行特征提取和匹配,同住的同位计算。

有帮助吗?

解决方案

如果您有同住的惯用,则您也有旋转。一旦您拥有同性选项,它很容易获得旋转和翻译矩阵。 例如,如果使用OpenCV C ++:

param[in] H
param[out] pose
void cameraPoseFromHomography(const Mat& H, Mat& pose)
{
    pose = Mat::eye(3, 4, CV_32FC1);      // 3x4 matrix, the camera pose
    float norm1 = (float)norm(H.col(0));  
    float norm2 = (float)norm(H.col(1));  
    float tnorm = (norm1 + norm2) / 2.0f; // Normalization value

    Mat p1 = H.col(0);       // Pointer to first column of H
    Mat p2 = pose.col(0);    // Pointer to first column of pose (empty)

    cv::normalize(p1, p2);   // Normalize the rotation, and copies the column to pose

    p1 = H.col(1);           // Pointer to second column of H
    p2 = pose.col(1);        // Pointer to second column of pose (empty)

    cv::normalize(p1, p2);   // Normalize the rotation and copies the column to pose

    p1 = pose.col(0);
    p2 = pose.col(1);

    Mat p3 = p1.cross(p2);   // Computes the cross-product of p1 and p2
    Mat c2 = pose.col(2);    // Pointer to third column of pose
    p3.copyTo(c2);       // Third column is the crossproduct of columns one and two

    pose.col(3) = H.col(2) / tnorm;  //vector t [R|t] is the last column of pose
}
.

该功能计算来自同住的De摄像头姿势,其中包含旋转。对于进一步的理论信息,请遵循这个线程

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top