Load cv triangulate points()

asked 2015-07-28 03:37:45 -0600

SUHAS gravatar image

updated 2015-07-28 04:35:47 -0600

thdrksdfthmn gravatar image

Hi everyone,

I am working on cv triangulatepoints(). I have keypoint values and projection matrix and I did tringulation using opencv function. But I could not able to load the points to point3d variable. I am getting error at double w = out.at<double>(3,0);. I am trying to take x,y,z axis for one keypoint out of my 383 keypoints. Can anyone please suggest me.

int N = inp1.size();
cv::Mat out = cv::Mat(4,N, CV_64FC1);
cv::triangulatePoints( P, P1, inp1, inp2, out);
"out = " << out << endl;
w = out.at<double>(3,0);
x = out.at<double>(0,0)/w;
y = out.at<double>(1,0)/w;
z = out.at<double>(2,0)/w;
push_back(cv::Point3f(x,y,z));
edit retag flag offensive close merge delete

Comments

Have you tried to change output to cv::Mat(1,N,CV_64FC4) ?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 04:41:02 -0600 )edit

Yes, it didn't worked! The output from my program is 4xN matrix which has x,y,z,w values I want store this in vector list of double for individual axis. Now I am trying to store only for one keypoint.

SUHAS gravatar imageSUHAS ( 2015-07-28 04:52:19 -0600 )edit

Have you tried std::vector< cv::Point4d > ?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 05:04:40 -0600 )edit

It is saying that vector<error type="">, is there point4d type ?

SUHAS gravatar imageSUHAS ( 2015-07-28 05:36:42 -0600 )edit

can you post the error too?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 06:26:52 -0600 )edit

Have you seen this? Or maybe this one?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 06:33:35 -0600 )edit

I have seen this. I was using code from "Multiple View Geometry in Computer Vision" but the output was not good... there are many confusions in that book.

SUHAS gravatar imageSUHAS ( 2015-07-28 06:43:00 -0600 )edit