triangulate 3d points from stereo images?

asked 2015-06-11 16:19:12 -0600

stillNovice gravatar image

updated 2015-06-12 06:37:33 -0600

I have a stereo pair of images, downloaded from a dataset along with the camera calibration data.

I am using the camera projection matrices, which look like this:

6.452401 0.000000 6.359587 0.000000 
0.000000 6.452401 1.941291 0.000000
0.000000 0.000000 1.000000 0.000000


6.452401 0.000000 6.359587 -3.682632 
0.000000 6.452401 1.941291 0.000000 
0.000000 0.000000 1.000000 0.000000

I have feature matched keypoints on both frames, which I then run through triangulatepoints, like this:

vector<cv::Point2f> points2dLeft, points2dRight;

cv::Mat points_3D(1, 5, CV_64FC4);


for (std::vector<cv::DMatch>::const_iterator it = good_matches.begin(); it != good_matches.end(); ++it)
{

    float x = keypoints1[it->queryIdx].pt.x;
    float y = keypoints1[it->queryIdx].pt.y;
    points2dLeft.push_back(cv::Point2f(x, y));

    x = keypoints2[it->trainIdx].pt.x;
    y = keypoints2[it->trainIdx].pt.y;
    points2dRight.push_back(cv::Point2f(x, y));
}


cv::triangulatePoints(P1, P2, points2dLeft2, points2dRight2, points_3D);

These are the 2d points:

http://s000.tinyupload.com/download.p... http://s000.tinyupload.com/download.p...

and this is the camera data:

http://www.mrt.uni-karlsruhe.de/geige...

I have also tried the method here:

http://www.morethantechnical.com/2012...

which gives different,, but just as awful results. Has anyone successfully done this and created an accurate point cloud?

edit retag flag offensive close merge delete

Comments

There are so many factors playing. How good is your calibration? How much inliers/outliers at your keypoints, ... give us actual data that you use and we might be able to say something good.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-12 06:10:13 -0600 )edit

Hi, thanks for replying. I am using the calibration file that came with the dataset, it should be as accurate as is possible. I am using SURF to get features, BM matcher and then RANSAC to remove outliers. The points I feed to the triangulation SHOULD be corresponding, right? I have updated my question with more info, including the 2d points that I am getting.

stillNovice gravatar imagestillNovice ( 2015-06-12 06:33:54 -0600 )edit

Any update on this?

Can you tell me why did you choose to insert negative value for translation in your projection matrix (-3.682632 )?

acajic gravatar imageacajic ( 2015-10-01 06:39:37 -0600 )edit