당신이 동역학을 가지고 있다면 당신도 로테이션을 가지고 있습니다. 일단 동질화가되면 회전 및 변환 행렬을 쉽게 얻을 수 있습니다. 예를 들어
, 당신은 ++에서 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
}
이 기능은 계산한다. 자세한 이론 정보는 thread을 참조하십시오.
감사합니다. @Jav_Rock, 귀하의 답변은 포즈를 추정하는 데 도움이되었습니다. 그러나 모든 이미지 세트 포즈 행렬에 대해 동일하게 오면 처음 세 열은 항등 행렬을 형성하고 마지막 열은 비어 있습니다. 이것에 대해 어떤 생각을 갖고 있습니까? – Aarambh
또한 warpAffine을 사용하여 호모 그래피 행렬을 확인했습니다. warpAffine은 이미지의 뷰를 다른 이미지로 올바르게 매핑합니다. – Aarambh
@ user1709317 : 'H'와 '포즈'는 같은 형식이어야합니다. 'CV_32FC1'->'CV_64FC1'을 변경하면 아마 원하는 결과를 얻게 될 것입니다. – bjoernz