3 x 3 matrix인 Fundamenta matrix F는 8개의 corresponding point가 주어질 경우, unique하게 결정될 수 있다.
<!-- MATH ${\tt m}=[x \, y \, 1]^\top,{\tt m'}=[x' y' 1]^\top$ -->
<!-- MATH ${\bf f}=[F_{11} F_{12} F_{13} F_{21} F_{22} F_{23} F_{31} F_{32} F_{33} ]^\top$ -->
라고 하자.
<!-- MATH \begin{equation} {\bf A} {\bf f}= 0 \end{equation} -->
위 식을 이용하여, 두 점과 f는 아래와 같이 나타낼 수 있다.
<!-- MATH \begin{equation} \left[ \begin{array}{ccccccccc} x x' & y x' & x' & x y' & y y' & y' & x & y & 1 \end{array} \right] {\bf f} = 0 \end{equation} -->
위 식을 사용하여 아래의 식을 생성한다.(마지막 항인 1은 생략이 가능하다.)
사용자 삽입 이미지
이 때, A는 8개의 corresponding point  pair를 이용하여 만든 matrix이다.
위 식에 의해, f는 A를 Singular Value Decomposition(SVD)를 통해서 계산될 수 있다.
A matrix는 SVD에 의해서 USVT로 decompose되고, f는 V matrix의 last column이 된다.

출처 : http://www.cs.unc.edu/~marc/tutorial/node54.html

아래는 위의 내용을 OpenCV로 작성해본 코드이다.
F33은 1이므로, 위 식의 A matrix에서 마지막 column은 제거하였다.

CvMat* A = cvCreateMat(8, 8, CV_32FC1);
CvMat* S = cvCreateMat(8, 1, CV_32FC1);
CvMat* U = cvCreateMat(8, 8, CV_32FC1);
CvMat* V = cvCreateMat(8, 8, CV_32FC1);

// assign A matrix
float* pA = A->data.fl;

// point assign code here
// pA[i * 8 + j] = x;

cvSVD(A, S, U, V);

// f is a vector containing the elements of fundamenta matrix F
// float* pV = V->data.fl;
// pV[i * 8 + 7] ...


cvReleaseMat(&U);
cvReleaseMat(&S);
cvReleaseMat(&V);
cvReleaseMat(&A);

'Programming > Computer Vision' 카테고리의 다른 글

AutoAlbum  (0) 2009.05.02
Computer Vision at MSR Cambridge  (0) 2009.05.02
Posted by 한효정

블로그 이미지
착하게 살자.
한효정

카테고리

공지사항

Yesterday
Today
Total

달력

 « |  » 2024.3
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

최근에 올라온 글

최근에 달린 댓글

글 보관함