Ask Your Question

Revision history [back]

what does the result of triangulatePoints() from openCV should looks like?

Hi,

I'm trying to triangulate some points from a stereo camera system.

First, I used the sample "stereo_calib" (cpp) to get the extrinsic parameters in a yml file :

  • R
  • T
  • R1
  • R2
  • P1
  • P2
  • Q

Is there a way to check if the values are correct ?

Then I use the method:

cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMat* projPoints2,    CvMat* points4D)

I used P1 for projMatr1 and P2 for projMatr2.

The point I want to triangulate is at coordinate x=919,y=686 on left image and x=586,y=694 on the right one. I tried this but I'm not sure if it's the good way:

int co1[] = {919,686};
Mat point1(2, 1, CV_32FC1, co1);
int co2[] = {586,694};
Mat point2(2, 1, CV_32FC1, co2);
Mat points4D;

I used point1 for projPoints1 and point2 for projPoints2. I wrote points4D in a yml file at the end. This is the result I got:

%YAML:1.0
Points4D: !!opencv-matrix
    rows: 4
    cols: 1
    dt: f
    data: [ 2.34857202e-001, 1.03716120e-001, -9.66480732e-001,
            1.43435571e-007 ]

What does it mean ? The three first values are x, y and z of the reconstruct point ? The values seems strange to me, but I'm really knew with openCV do I don't know much about it.

I found this related question: How to correctly use cv::triangulatePoints(). But it didn't really help me...

Thanks for the help !