多视图几何 [英] Multiple-View Geometry

查看:191
本文介绍了多视图几何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个从相同品牌的相机拍摄的图像,相距一定距离,以拍摄相同的场景.我想计算两个相机之间的真实世界旋转和平移.为了实现这一目标,我首先提取了两个图像的SIFT特征并将其匹配.

I've two images captured from two cameras of same make placed some distance apart, capturing the same scene. I want to calculate the real world rotation and translation among the two cameras. In order to achieve this, I first extracted the SIFT features of both of the images and matched them.

我现在有基本矩阵单应矩阵.但是无法继续进行,造成了很多混乱.有人可以帮助我估计两个摄像机之间的旋转和平移吗?

I now have fundamental matrix as well as homography matrix. However unable to proceed further, lots of confusion. Can anybody help me to estimate the rotation and translation in between two cameras?

我正在使用OpenCV进行特征提取和匹配,单应性计算.

I'm using OpenCV for feature extraction and matching, homography calculations.

推荐答案

如果您有同形,那么您也可以旋转.一旦有了单应性,就很容易获得旋转和平移矩阵.

If you have the Homography then you also have the rotation. Once you have homography it is easy to get rotation and translation matrix.

例如,如果您使用的是OpenCV c ++:

For example, if you are using 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
}

此功能根据包含旋转的单应性计算相机的姿态.有关更多理论信息,请遵循此线程.

This function calculates de camera pose from homography, in which rotation is contained. For further theoretical info follow this thread.

这篇关于多视图几何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆