Hello,

I am using the computer vision libraries in OpenCV - if anybody is familiar with these then maybe you can help

I am trying to estimate the fundamental matrix between two images, using
cvFindFundamentalMat(). I have created two matrices representing points in the
left (points1) and right (points2) images. I have assigned values to these
points, such that the points in the left image form a diagonal across the image,
starting at the origin, and the points in the right image also form a diagonal,
but shifted +10 to the right.

Below is the code I have used:


Code:
CvMat* points1;
CvMat* points2;
CvMat* status;
CvMat* fundamental_matrix;

points1 = cvCreateMat(2, 20, CV_32FC1);
points2 = cvCreateMat(2, 20, CV_32FC1);
status = cvCreateMat(1, 20, CV_8UC1);

for (int i = 0; i < 20; i ++)
{
cvmSet(points1, 0, i, i);
cvmSet(points1, 1, i, i);
cvmSet(points2, 0, i, i + 10);
cvmSet(points2, 1, i, i);
}

fundamental_matrix = cvCreateMat(3, 3, CV_32FC1);
cvFindFundamentalMat(points1, points2, fundamental_matrix, CV_FM_RANSAC, 1.0,
0.99, status);

for (int i = 0; i < 3; i ++)
{
for (int j = 0; j < 3; j ++)
{
cout << cvmGet(fundamental_matrix, i, j) << endl;
}
}

for (int i = 0; i < 20; i ++)
{
cout << cvmGet(status, 0, i) << endl;
}

This is not working in two ways:

First, when I print out the values of the fundamental matrix, it tells me that
every element of the matrix "fundamental_matrix" is equal to -0.00132704. I'm
sure this is incorrect. For a start, I know that the (3, 3) element of the
matrix should be equal to 1. Any ideas why this isn't working?

Second, when the code reaches the part where it prints out the values of the
matrix "status", there is a runtime error, printing the following message:

"This application has requested the Runtime to terminate in an unusual way.
Please contact the application's support team for more information."

So I cannot print these values for some reason. Any help?

Thanks so much if anybody can spot what I am doing wrong