문제

저는 동일한 장면을 캡처하여 똑같은 두 개의 카메라에서 캡처 한 두 개의 이미지를 캡처했습니다.나는 두 카메라간에 실제 세계 회전과 번역을 계산하고 싶습니다.이를 달성하기 위해 먼저 두 이미지의 SIFT 기능을 추출하고이를 일치시킵니다.

이제 근본적인 행렬 뿐만 아니라 homography matrix 를 가지고 있습니다.그러나 더 나아가 더 많은 혼란을 진행할 수 없습니다.두 개의 카메라 사이에서 로 추산하는 데 도움이 될 수 있습니까?

기능 추출 및 일치하는 homography 계산을 위해 OpenCV를 사용하고 있습니다.

도움이 되었습니까?

해결책

homography가있는 경우 회전이 있습니다.일단 homography가되면 회전 및 번역 매트릭스를 얻을 수 있습니다.

예를 들어 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
}
.

이 함수는 회전이 포함 된 homography에서 드 카메라 포즈를 계산합니다.더 많은 이론적 인 정보를 위해이 나사 .

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top